<template>
    <div style=" position: relative;"><el-card>
            <template #header>
                <!-- 搜索 -->
                <div>

                    <el-select style="width:160px" v-model="find_data.routeSimpleName" placeholder="请选择行程简称" clearable>
                        <el-option v-for="item in routeSimpleName_list" :key="item.value" :label="item.label"
                            :value="item.value" />
                    </el-select>
                    <el-select style="width:120px;margin-left: 10px;" v-model="find_data.serviceMan" placeholder="请选业务员"
                        clearable>
                        <el-option v-for="item in getServiceMans_list" :key="item.ftUserId" :label="item.realName"
                            :value="item.ftUserId" />
                    </el-select>

                    <el-select style="width:100px;margin-left: 10px;" v-model="find_data.timeType"
                        :placeholder="'时间类型'">
                        <el-option :label="'用车时间'" :value="'0'"></el-option>
                        <el-option :label="'下单时间'" :value="'1'"></el-option>
                        <el-option :label="'续团时间'" :value="'2'"></el-option>
                    </el-select>

                    <el-date-picker :default-time="defaultTime" style="margin-left: 10px;width: 340px;"
                        v-model="timeTypeTime" @change="timeTypeTime_btn" type="datetimerange" start-placeholder="开始时间"
                        end-placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />

                    <el-select v-model="find_data.orderByCondition" :placeholder="'排序'"
                        style="width: 80px;margin-left: 10px;">
                        <el-option :label="'升序'" :value="'0'"></el-option>
                        <el-option :label="'降序'" :value="'1'"></el-option>
                    </el-select>

                    <el-input style="width: 140px;margin-left: 10px;" placeholder="订单号" v-model="find_data.orderNum">
                    </el-input>

                    <!-- <el-input style="width: 220px;margin-left: 10px;" placeholder="行程详情/客户/驾驶员/业务员备注"
                        v-model="find_data.details">
                    </el-input> -->
                    <el-input style="width: 180px;margin-left: 10px;" placeholder="驾驶员姓名/手机号" maxlength="11"
                        v-model="find_data.driverName">
                    </el-input>
                    <el-select v-model="find_data.statusList" multiple collapse-tags :placeholder="'订单状态'"
                        style="width: 180px;margin-left: 10px;">
                        <el-option v-for="it in orderStates" :label="it.name" :key="it.id" :value="it.id">
                        </el-option>
                    </el-select>
                    <el-select clearable v-model="find_data.type" :placeholder="'订单类型'"
                        style="width: 120px;margin-left: 10px;">
                        <el-option :label="'拼车订单'" :value="'0'"></el-option>
                        <el-option :label="'顺风车订单'" :value="'1'"></el-option>
                        <el-option :label="'包车订单'" :value="'2'"></el-option>
                    </el-select>

                    <div style="margin-top:10px;display: flex;">
                        <el-input style="width: 80px;" placeholder="座位数" maxlength="2"
                            onkeyup="this.value = this.value.replace(/^(0+)|[^\d]+/g, '');"
                            v-model="find_data.needSeats">
                        </el-input>
                        <el-input style="width: 100px;margin-left: 10px;" placeholder="车牌号" maxlength="8"
                            v-model="find_data.plateNum">
                        </el-input>

                        <el-select @change="cusCompanySimpleName_change" clearable
                            style="width: 200px;margin-left: 10px;" filterable remote
                            :filter-method="findComboCusList_list_handleFilter" v-model="find_data.userId"
                            placeholder="请选择用车单位">
                            <el-option v-for="(item, index) in findComboCusList_list_yongche" :key="index"
                                :label="item.cusCompanyName" :value="item.userId">
                                <span style="float: left">{{ item.cusCompanyName }}</span>
                                <span style="
                            float: right;
                            color: var(--el-text-color-secondary);
                            font-size: 13px;
                          ">{{ item.cusRealName + '【' + item.cusPhone + '】' }}</span>
                            </el-option>
                        </el-select>
                        <el-select clearable v-model="find_data.useCarDutyUserId" :placeholder="'用车单位负责人'"
                            style="width: 180px;margin-left: 10px;">
                            <el-option v-for="it in dutyService_list" :label="it.name" :key="it.id" :value="it.id">
                            </el-option>
                        </el-select>

                        <el-select filterable remote :filter-method="handleFilter" @change="carCompanyId_change2"
                            clearable style="width: 200px;margin-left: 10px;" v-model="find_data.carCompanyId"
                            placeholder="请选择供车单位">
                            <el-option v-for="(item, index) in findComboCusList_list" :key="index"
                                :label="item.cusCompanyName" :value="item.id">
                                <span style="float: left">{{ item.cusCompanyName }}</span>
                                <span style="
                        float: right;
                        color: var(--el-text-color-secondary);
                        font-size: 13px;
                      ">{{ item.cusRealName + '【' + item.cusPhone + '】' }}</span>
                            </el-option>
                        </el-select>
                        <el-select clearable v-model="find_data.carDutyUserId" :placeholder="'供车负责人'"
                            style="width: 180px;margin-left: 10px;">
                            <el-option v-for="it in dutyService_list2" :label="it.name" :key="it.id" :value="it.id">
                            </el-option>
                        </el-select>
                        <el-select multiple collapse-tags clearable v-model="companyNums" :placeholder="'托管单位名称'"
                            style="width: 150px;margin-left:10px;">
                            <template #header>
                                <el-checkbox v-model="checkAll" :indeterminate="indeterminate" @change="handleCheckAll">
                                    全选
                                </el-checkbox>
                            </template>
                            <el-option v-for="item in findTrusteeshipMeComboList" :key="item.id"
                                :label="item.companyName" :value="item.companyNum">
                            </el-option>
                        </el-select>
                        <el-select clearable v-model="find_data.externalTransfer" :placeholder="'是否查询外调订单'"
                            style="width: 180px;margin-left: 10px;">
                            <!-- <el-option :label="'否'" :value="'0'"></el-option> -->
                            <el-option :label="'是'" :value="'1'"></el-option>
                        </el-select>
                        <el-button style="margin-left: 20px;height:30px" @click="search_btn" type="primary"
                            icon="Search">搜索</el-button>
                    </div>

                </div>
                <!-- 功能按钮 -->
                <div style="margin-top:10px;display: flex;">
                    <el-button @click="up_btn" type="warning" icon="WarnTriangleFilled">修改</el-button>
                    <el-button @click="copy_btn" type="warning" icon="CopyDocument">复制</el-button>
                    <el-button @click="del_btn" type="danger" icon="CircleCloseFilled">删除订单</el-button>
                    <el-button :disabled="isTrustee == 1" @click="cancelDispatchCar_btn" type="warning"
                        icon="WarnTriangleFilled">取消派车</el-button>
                    <el-button :disabled="isTrustee == 1" @click="mergeProcess_btn" type="warning"
                        icon="CopyDocument">合并订单</el-button>
                    <el-button :disabled="isTrustee == 1" @click="cancelMergeProcess_btn" type="warning"
                        icon="FolderOpened">取消合并订单</el-button>
                    <el-button @click="setHelpGathUrl_btn" type="primary" icon="FullScreen">代收二维码</el-button>
                    <el-button :disabled="isTrustee == 1" @click="isUseDidi_btn" type="primary"
                        icon="Promotion">滴滴打车设置</el-button>
                    <el-button @click="circleCheck_btn" type="primary" icon="CircleCheck">线下订单确认完团</el-button>
                    <el-button @click="cancelGathLock_btn" type="primary" icon="CircleCheck">解锁订单</el-button>
                    <el-button @click="adupRewardPunish_btn" type="primary" icon="Notification">投诉处理</el-button>
                </div>

                <div style="display:flex;height:30px;margin-top:5px;align-items: center;background:pink">
                    <b style="color:red;font-weight:700">订单总价:{{ totalPrice }}元</b>
                    <el-divider direction="vertical"></el-divider>
                    <b style="color:green;font-weight:700">已派车:{{ totalSendCar }}单</b>
                    <el-divider direction="vertical"></el-divider>
                    <b style="color:red;font-weight:700">未派车:{{ totalUnSendCar }}单</b>
                    <el-divider direction="vertical"></el-divider>
                    <b style="color:green;font-weight:700">未通知:{{ totalNoConfirm }}单</b>
                    <el-divider direction="vertical"></el-divider>
                    <b style="color:red;font-weight:700">已通知:{{ totalDriverNoConfirm }}单</b>
                    <el-divider direction="vertical"></el-divider>
                    <b style="color:green;font-weight:700">已确认:{{ totalDriverConfirm }}单</b>
                    <el-divider direction="vertical"></el-divider>
                    <b style="color:red;font-weight:700">运行中:{{ totalOnRoad }}单</b>
                    <el-divider direction="vertical"></el-divider>
                    <b style="color:green;font-weight:700">已完团:{{ totalFinished }}单</b>

                </div>
            </template>
            <div>
                <el-table :scrollbar-always-on="true" :resizable='true' @header-dragend='headerdragend'
                    :cell-style="cellStyle" :row-style="rowStyle" border @selection-change="selection_change_btn"
                    height="58vh" ref="multipleTableRef" :data="list_data" style="width: 100%">
                    <el-table-column type="selection" width="35" />
                    <el-table-column label="编号" width="55" fixed type="index" />

                    <template v-for="item in table_data_list_new" :key="item.field">
                        <el-table-column v-if="item.off" :width="item.width" :prop="item.field" :label="item.label">

                            <template v-if="item.field == 'routeSimpleName'" #="{ row, column, $index }">

                                <div>
                                    <span v-if="row.isTrusteeOrder == 1">
                                        <el-button circle type="danger" size="small">托</el-button>
                                    </span>

                                    <span>{{ row.routeSimpleName }}</span>
                                    <div v-if="row.accidentList">
                                        <el-button :disabled="isTrustee == 1" style="color:#fff;font-weight:700"
                                            @click.native="accidentRecord_btn(row)" type="danger"
                                            size="small">异常</el-button>
                                    </div>


                                </div>
                            </template>
                            <template v-if="item.field == 'status'" #="{ row, column, $index }">



                                <div>
                                    <span>
                                        {{ row.status == 'NOT_GRAB' ? '未抢单' : row.status == 'READY_CAR' ? '未派车' :
                                            row.status
                                                ==
                                                'CAR_READY_CONFIRME' ? '未通知' : row.status == 'DRIVER_READY_RECEIVE' ? '师傅未确认' :
                                                row.status ==
                                                    'DRIVER_CONFIRMED'
                                                    ? '师傅已确认' : row.status == 'START_TAKE_CUS' ? '出发去接客户' : row.status ==
                                                        'ON_ROADING' ?
                                                        '已出行' :
                                                        row.status == 'FINISHED' ? '已完团' : row.status == 'CANCELED' ? '已取消' : row.status
                                                            ==
                                                            'REFUSED'
                                                            ?
                                                            '已拒绝' : row.status == 'DELETE' ? '已删除' : '其他' }}
                                    </span>
                                    <span v-if="row.rewardPunishId">
                                        <el-button :disabled="isTrustee == 1" style="color:#fff;font-weight:700"
                                            @click.native="getRewardPunishById_btn(row)" type="danger"
                                            size="small">投诉</el-button>
                                    </span>



                                </div>
                                <div v-if="row.status == 'READY_CAR'">
                                    <el-button :disabled="isTrustee == 1" @click="vehicles_btn(row)" type="primary"
                                        size="small">派车</el-button>
                                </div>


                                <div v-if="row.status == 'CAR_READY_CONFIRME'">
                                    <el-button :disabled="isTrustee == 1" @click="noticeDriver(row)" type="primary"
                                        size="small">通知</el-button>

                                </div>
                                <div
                                    v-if='row.orderSource != "WX_MP_CARTEAM" && row.orderSource != "PC_CAR_TEAM" && row.isUseTeamPriceTemplates == "0" && row.isReceiveByTeam == "0" && row.type != "2"'>
                                    <el-button :disabled="isTrustee == 1" @click="receiveOrRefuse_btn(row)"
                                        type="danger" size="small">确认/拒绝</el-button>
                                </div>

                            </template>

                            <!-- <template v-if="item.field == 'accidentList'" #="{ row, column, $index }">

                                <div v-if="row.accidentList">
                                    <el-button @click.native="accidentRecord_btn(row)" type="primary"
                                        size="small">异常报备</el-button>

                                </div>

                                <div v-else>
                                    无

                                </div>
                            </template> -->

                            <template v-if="item.field == 'plateNum'" #="{ row, column, $index }">
                                <span>{{ row.plateNum }}</span>
                                <div v-if="row.plateNum">
                                    <el-button :disabled="isTrustee == 1" @click="up_car(row)" type="primary"
                                        size="small">修改车辆</el-button>

                                </div>
                            </template>

                            <template v-if="item.field == 'driverName'" #="{ row, column, $index }">
                                <span>{{ row.driverName ? row.driverName + '-' + row.driverPhone : '' }}</span>
                                <div v-if="row.plateNum">
                                    <el-button :disabled="isTrustee == 1" @click="up_driverName(row)" type="primary"
                                        size="small">修改驾驶员</el-button>

                                </div>
                            </template>

                            <template v-if="item.field == 'pricealGathPrice'" #="{ row, column, $index }">
                                <span>{{ row.price - row.alGathPrice }}</span>
                            </template>
                            <template v-if="item.field == 'price'" #="{ row, column, $index }">
                                <span>{{ price_api(row) }}</span>
                                <!-- <span style="color:red;" v-if="row.couponMoney > 0 || row.pointMoney > 0">
                                    {{ price_api2(row) }}
                                </span> -->
                                <span style="color:red;" v-if="row.couponMoney > 0 || row.pointMoney > 0">
                                    抵
                                </span>
                                <span style="color:red;" v-if="row.couponMoney > 0">
                                    / {{ row.couponMoney }}
                                </span>
                                <span style="color:red;" v-if="row.pointMoney > 0">
                                    / {{ row.pointMoney }}
                                </span>
                                <span v-if="row.helpGathUrl">
                                    <el-button :disabled="isTrustee == 1" style="color:#fff;font-weight:700"
                                        @click.native="setHelpGathUrl_btn2(row)" type="danger"
                                        size="small">代收</el-button>
                                </span>


                            </template>
                            <template v-if="item.field == 'needSeats'" #="{ row, column, $index }">
                                <span>{{ row.needSeats ? row.needSeats + '座' : '不限车型' }}</span>
                                <span style="color:red;">{{ carConfig_list_api(row) }}</span>
                            </template>
                            <template v-if="item.field == 'useCarCompanyId'" #="{ row, column, $index }">
                                <!-- row.realName ? row.realName  : -->
                                <!-- <span>{{
                        row.useCarCompanyName ? row.useCarCompanyName : row.mobile
                    }}{{ row.mobile ? '-' + row.mobile : '' }}</span> -->
                                <span>{{ useCarCompanyId_data_api(row) }}</span>
                            </template>

                            <template v-if="item.field == 'useCarDutyInfo'" #="{ row, column, $index }">
                                <!-- <span>{{
                        row.useCarDutyInfo ? row.useCarDutyInfo.split('-').length > 2 ? row.useCarDutyInfo.split('-')[1] + '-' + row.useCarDutyInfo.split('-')[2] : row.useCarDutyInfo.split('-')[0] + '-' + row.useCarDutyInfo.split('-')[1]
                            : '' }}</span> -->
                                <span>{{ useCarDutyInfo_data_api(row) }}</span>
                            </template>

                            <template v-if="item.field == 'carDutyUserInfo'" #="{ row, column, $index }">
                                <span>{{
                                    row.carDutyUserInfo ? row.carDutyUserInfo.split('-').length > 2 ?
                                        row.carDutyUserInfo.split('-')[1] + '-' + row.carDutyUserInfo.split('-')[2] :
                                        row.carDutyUserInfo.split('-')[0] + '-' + row.carDutyUserInfo.split('-')[1]
                                        : '' }}</span>
                            </template>
                            <template v-if="item.field == 'cusName'" #="{ row, column, $index }">
                                <span>{{ row.cusInfo }}</span>
                            </template>

                            <template v-if="item.field == 'startDate'" #="{ row, column, $index }">
                                <span>{{ row.startTime.split(' ')[0] }}</span>
                            </template>
                            <template v-if="item.field == 'persons'" #="{ row, column, $index }">
                                <span>{{ row.serviceMan ? row.serviceMan.split('-')[1] + '-' +
                                    row.serviceMan.split('-')[2]
                                    : '' }}</span>
                            </template>

                            <template v-if="item.field == 'startTime'" #="{ row, column, $index }">
                                <span>{{ row.startTime.split(' ')[1] }}</span>
                            </template>

                            <template v-if="item.field == 'endDate'" #="{ row, column, $index }">
                                <span>{{ row.endTime.split(' ')[0] }}</span>
                            </template>

                            <template v-if="item.field == 'endTime'" #="{ row, column, $index }">
                                <span>{{ row.endTime.split(' ')[1] }}</span>
                            </template>
                            <template v-if="item.field == 'orderNum'" #="{ row, column, $index }">

                                <!-- <el-button type=""  bg text style="font-weight:700"
                                @click='orderNum_btn(row)' 
                                size="small">{{ row.orderNum }}</el-button> -->
                                <span @click='orderNum_btn(row)' style='text-decoration: underline; cursor: pointer;'>{{
                                    row.orderNum }}</span>
                            </template>
                        </el-table-column>
                    </template>



                </el-table>
            </div>

            <div style="margin-top:20px">
                <el-pagination @current-change="current_change_btn" @size-change="size_change_btn"
                    v-model:current-page="find_data.page.pageNum" v-model:page-size="find_data.page.pageSize"
                    :page-sizes="[100, 200, 300, 500]" :background="true"
                    layout="prev, pager, next, jumper,->,sizes,total," :total="total" />
            </div>
        </el-card>
    </div>

    <!-- 弹窗 -->
    <div>
        <!-- 表格筛选 -->
        <div style="position: absolute;top:100px;z-index: 9999;" :style="icon_off ? 'right:0px;' : 'right:110px;'">
            <el-icon @click="icon_btn" :size="20">
                <Setting />
            </el-icon>
            <div v-show="icon_off"
                style=" position: relative;top:-100px;right:140px;width: 130px;height:430px;background:#fff;overflow: hidden;">
                <div class="cols-set" style="background:#fff;width:90%;height:97%;margin:auto;margin-top:10px;">
                    <div>
                        <el-button-group style="display: flex; ">
                            <el-tooltip effect="dark" placement="bottom">

                                <template #content>注意：拖动下面的项，可以改变表格列的顺序，<br />记得点击保存才会永久生效哦！ </template>
                                <el-button style="width:10px" type="primary" icon="WarningFilled"></el-button>
                            </el-tooltip>
                            <el-button title="重置" type="primary" icon="Refresh" @click="resetTableSet"></el-button>
                            <el-button title="保存" type="primary" icon="Check" @click="saveTableSet"></el-button>
                        </el-button-group>
                        <div ref="sortableContainer" class="col-items" style="height:400px; overflow-y: auto; ">
                            <el-checkbox class="drag_it" @change="checkbox_btn" v-for="item in sortedItems"
                                :key="item.field" v-model="item.off" :label="item.label" border>
                            </el-checkbox>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!-- 代收二维码 -->
        <el-dialog style="margin-top:5vh" v-model="QRcode.off" title="上传代收二维码与代收金额" width="30%"
            :close-on-click-modal='false'>
            <div style="display: flex;    justify-content: space-evenly;">
                <div>
                    代收二维码:
                    <el-upload style="margin-top: 10px;" class="avatar-uploader" :action="ImageUrl_upload"
                        :headers="{ token: GET_TOKEN() }" :data="{ ftype: 'BACK_SET_DATA_IMG', files: rawFile_list }"
                        :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :show-file-list="false">
                        <img v-if="QRcode.helpGathUrl" :src="ImageUrl + QRcode.helpGathUrl" class="avatar" />
                        <el-icon v-else class="avatar-uploader-icon">
                            <Plus />
                        </el-icon>
                    </el-upload>
                    <el-button @click="remove_btn" style='margin: 10px 0px 0px 70px ;' type="danger">删除</el-button>
                </div>
                <div style="margin-left:10px">
                    代收金额:
                    <el-input type="number" placeholder="请输入金额" v-model="QRcode.helpGathPrice">
                    </el-input>
                </div>
            </div>

            <el-button style="margin-left:23vw" type="primary" @click="addQRcodeBtn()">确 定</el-button>
        </el-dialog>
        <!-- 滴滴打车设置 -->
        <el-dialog style="margin-top:5vh" v-model="isUseDidi_data.off" title="滴滴打车设置" width="30%"
            :close-on-click-modal='false'>
            <div> 设置值:
                <el-switch v-model="isUseDidi_data.isUseDidi" active-color="#13ce66" inactive-color="#DCDFE6">
                </el-switch>
            </div>

            <el-button style="margin-left:23vw" type="primary" @click="isUseDidiBtn()">确 定</el-button>
        </el-dialog>
        <!-- 派车 -->
        <el-dialog style="margin-top:5vh" v-model="vehicles_off" title="汽车智选" width="87%" :close-on-click-modal='false'>
            <div>
                <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">

                    <el-tab-pane label="智能派车" name="智能派车">
                        <div style="display:flex;margin-bottom:20px;font-weight:700">
                            <b>{{ vehicles_data.routeSimpleName }}</b>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.startTime }}</b>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.endTime }}</b>
                            <el-divider direction="vertical"></el-divider>
                            <el-tooltip effect="dark" :content="vehicles_data.details" placement="bottom">
                                <b class="sl route-detail-text">{{ vehicles_data.details }}</b>
                            </el-tooltip>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.personNum }}人</b>
                            <el-divider direction="vertical"></el-divider>
                            <b>{{ vehicles_data.needSeats ? vehicles_data.needSeats + '座' : '不限车型' }}</b>
                        </div>

                        <template v-if="set_list">
                            <div v-for="item in set_list"
                                style="display:flex;margin-bottom:20px;font-weight:700;align-items: center;">
                                <b>{{ item.routeSimpleName }}</b>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.startTime }}</b>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.endTime }}</b>
                                <el-divider direction="vertical"></el-divider>
                                <el-tooltip effect="dark" :content="item.details" placement="bottom">
                                    <b class="sl route-detail-text">{{ item.details }}</b>
                                </el-tooltip>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.personNum }}人</b>
                                <el-divider direction="vertical"></el-divider>
                                <b>{{ item.needSeats ? item.needSeats + '座' : '不限车型' }}</b>
                                <el-button style="margin-left:10px" size="small" type="danger"
                                    @click="set_over_btn(item)">删除</el-button>
                            </div>
                        </template>
                        <el-divider class="seled-order-line"><b style="color:blue;">订单</b></el-divider>
                        <el-form class="form_Css" :inline="true">
                            <el-form-item>
                                <div style="font-weight:700">距该订单:</div>
                            </el-form-item>
                            <el-form-item>
                                <el-radio-group @change="filterOrder_data_radio_change"
                                    v-model="filterOrder_data_radio">
                                    <el-radio :label="1">起点</el-radio>
                                    <el-radio :label="2">终点</el-radio>
                                    <el-radio :label="3">套接</el-radio>
                                </el-radio-group>

                            </el-form-item>
                            <el-form-item>
                                <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" disabled
                                    v-model="filterOrder_data.stime" type="datetime" placeholder="开始日期" />
                            </el-form-item>
                            <el-form-item>
                                <el-select @change="filterOrder_data_change" v-model="filterOrder_data.time"
                                    :placeholder="'时间'" style="width: 120px">
                                    <el-option :label="'6小时'" value="6"></el-option>
                                    <el-option :label="'12小时'" value="12"></el-option>
                                    <el-option :label="'24小时'" value="24"></el-option>
                                    <el-option :label="'48小时'" value="48"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" disabled
                                    v-model="filterOrder_data.etime" type="datetime" placeholder="结束日期" />
                            </el-form-item>
                            <el-form-item>
                                <el-radio-group v-model="filterOrder_data_radio2">
                                    <el-radio :label="4">间隔时间升序</el-radio>
                                    <el-radio :label="5">行程耗时升序</el-radio>
                                </el-radio-group>
                            </el-form-item>

                            <el-form-item>
                                <el-select v-model="filterOrder_data.avgSpeed" :placeholder="'平均速度'"
                                    style="width: 120px">
                                    <el-option :label="'25公里/小时'" value="25"></el-option>
                                    <el-option :label="'30公里/小时'" value="30"></el-option>
                                    <el-option :label="'35公里/小时'" value="35"></el-option>
                                    <el-option :label="'40公里/小时'" value="40"></el-option>
                                    <el-option :label="'45公里/小时'" value="45"></el-option>
                                    <el-option :label="'50公里/小时'" value="50"></el-option>
                                    <el-option :label="'60公里/小时'" value="60"></el-option>
                                    <el-option :label="'70公里/小时'" value="70"></el-option>
                                    <el-option :label="'80公里/小时'" value="80"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="可重叠时间：">
                                <el-select v-model="filterOrder_data.overlapTime" :placeholder="'重叠时间'"
                                    style="width: 120px">
                                    <el-option :label="'0分钟'" value="0"></el-option>
                                    <el-option :label="'5分钟'" value="5"></el-option>
                                    <el-option :label="'10分钟'" value="10"></el-option>
                                    <el-option :label="'15分钟'" value="15"></el-option>
                                    <el-option :label="'20分钟'" value="20"></el-option>
                                    <el-option :label="'25分钟'" value="25"></el-option>
                                    <el-option :label="'30分钟'" value="30"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-button style="margin-left:20px" @click="filterOrder_data_find"
                                    type="primary">搜索</el-button>
                            </el-form-item>
                        </el-form>

                        <el-table @selection-change="filterOrder_selection_change_btn" :data="filterOrder_list" border
                            fit :height="350" style="width: 100%;margin-bottom: 20px;">

                            <!-- <el-table-column type="selection" width="35" /> -->
                            <el-table-column label="编号" width="55" fixed type="index" />
                            <el-table-column width="120" property="set" label="操作">

                                <template #default="scope">
                                    <el-button size="small" type="primary" @click="set_btn(scope.row)">确认选择</el-button>
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="routeSimpleName" label="行程简称" />
                            <el-table-column width="220" label="驾驶员">

                                <template #="{ row, column, $index }">
                                    <div v-if="row.plateNum">{{ row.plateNum }}（{{ row.driverName + '-' +
                                        row.driverPhone
                                        }}）</div>
                                    <div v-else></div>
                                </template>

                            </el-table-column>
                            <el-table-column width="170" property="startTime" label="出发时间" />
                            <el-table-column property="fromLocation" label="出发地点" />
                            <el-table-column property="toLocation" label="结束地点" />
                            <el-table-column width="170" property="endTime" label="结束时间" />
                            <el-table-column width="120" property="lastDetails" label="人数">

                                <template #="{ row, column, $index }">
                                    {{ row.personNum }}(人)
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="lastDetails" label="需求车型">

                                <template #="{ row, column, $index }">
                                    {{ row.needSeats ? row.needSeats : '不限车型' }}
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="remark" label="备注" />


                        </el-table>
                        <el-divider class="seled-order-line"><b style="color:rgb(255, 0, 55);">派车</b></el-divider>
                        <el-form class="form_Css" :inline="true">
                            <el-form-item>
                                <div style="font-weight:700">筛选车辆:</div>
                            </el-form-item>
                            <!-- <el-form-item>
                                <el-radio-group v-model="filterCar_data_radio">
                                    <el-radio :label="1">起点</el-radio>
                                    <el-radio :label="2">终点</el-radio>
                                    <el-radio :label="3">套接</el-radio>
                                </el-radio-group>

                            </el-form-item> -->
                            <el-form-item>
                                <el-button style="margin-right: 10px;" @click="needSeats_off = !needSeats_off"
                                    type="primary">选择/输入车型</el-button>
                                <el-input v-if="needSeats_off == false" @change="getCarConfigurationType_btn"
                                    type="number" style="width:150px" v-model="filterCar_data.seats" placeholder="座位数">
                                    <template #append>座</template></el-input>
                                <el-select v-if="needSeats_off == true" @change="getCarConfigurationType_btn"
                                    v-model="filterCar_data.seats" :filterable="false" placeholder="请选择车型"
                                    style="width: 160px;">
                                    <el-option label="不限车型" value="0"></el-option>
                                    <el-option label="5座" value="5"></el-option>
                                    <el-option label="7座" value="7"></el-option>
                                    <el-option label="9座" value="9"></el-option>
                                    <el-option label="12座" value="12"></el-option>
                                    <el-option label="14座" value="14"></el-option>
                                    <el-option label="17座" value="17"></el-option>
                                    <el-option label="23座" value="23"></el-option>
                                    <el-option label="30座" value="30"></el-option>
                                    <el-option label="39座" value="39"></el-option>
                                    <el-option label="49座" value="49"></el-option>
                                    <el-option label="55座" value="55"></el-option>

                                </el-select>

                                <!-- <el-input @change="getCarConfigurationType_btn" v-model="filterCar_data.seats"
                                    placeholder="座位数">

                                    <template #append>座</template>
                                </el-input> -->
                            </el-form-item>
                            <el-form-item>

                                <el-select v-model="filterCar_data.carConfig" clearable :filterable="false"
                                    placeholder="车辆配置" style="width: 360px;">
                                    <el-option v-for="item in getCarConfigurationType_list" :key="item.id"
                                        :label="item.val + '(' + item.other + ')'" :value="item.id" />

                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select clearable v-model="filterCar_data.plateNum" :placeholder="'车牌号'"
                                    style="width: 120px">
                                    <el-option v-for="item in carNumList" :key="item.id" :label="item.plate_num"
                                        :value="item.plate_num"></el-option>
                                </el-select>
                            </el-form-item>

                            <el-form-item>
                                <el-select v-model="filterCar_data.driverUserIdIsNull" :placeholder="'是否有驾驶员'"
                                    style="width: 120px">
                                    <el-option :label="'没有驾驶员'" value="0"></el-option>
                                    <el-option :label="'有驾驶员'" value="1"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-select v-model="filterCar_data.fastCondition" :placeholder="'重叠时间'"
                                    style="width: 120px">
                                    <el-option :label="'月佣金(工资)升序'" value="0"></el-option>
                                    <el-option :label="'评分最高降序'" value="1"></el-option>
                                    <el-option :label="'最快达到'" value="2"></el-option>
                                </el-select>
                            </el-form-item>

                            <el-form-item>
                                <el-select multiple collapse-tags clearable v-model="companyNums2"
                                    :placeholder="'托管单位名称'" style="width: 150px;">
                                    <template #header>
                                        <el-checkbox v-model="checkAll2" :indeterminate="indeterminate2"
                                            @change="handleCheckAll2">
                                            全选
                                        </el-checkbox>
                                    </template>
                                    <el-option v-for="item in findTrusteeshipMeComboList" :key="item.id"
                                        :label="item.companyName" :value="item.companyNum">
                                    </el-option>
                                </el-select>
                            </el-form-item>

                            <el-form-item>
                                <el-button style="margin-left:20px" @click="filterCar_data_find"
                                    type="primary">搜索</el-button>
                            </el-form-item>
                        </el-form>
                        <el-table :data="filterCar_list" border fit :height="350"
                            style="width: 100%;margin-bottom: 20px;" :cell-style="cellStyle2">
                            <!-- <el-table-column type="selection" width="35" /> -->
                            <el-table-column label="编号" width="55" fixed type="index" />
                            <el-table-column width="200" property="plateNum" label="车牌号">

                                <template #="{ row, column, $index }">
                                    {{ row.seats + '座-' + row.plateNum }} <span v-if="row.isRestricted"
                                        style="color:Red">(限号)</span><br>
                                    <el-button @click="filterCar_data_ok_btn(row)" size="small"
                                        type="primary">派车</el-button>
                                </template>
                            </el-table-column>
                            <el-table-column width="180" property="driverName" label="驾驶员">

                                <template #="{ row, column, $index }">
                                    <span v-if="row.leaveDetails">
                                        <el-tooltip :popper-class="'route-tips'" placement="left">
                                            <template #content>{{ row.leaveDetails }}</template>
                                            <span
                                                style="  width: 100px; white-space: nowrap; text-overflow: ellipsis; ">
                                                {{
                                                    row.driverName ? row.driverName + '-' + row.driverPhone : '无主驾'
                                                }}</span>
                                        </el-tooltip>
                                    </span>
                                    <span v-else>
                                        {{ row.driverName ? row.driverName + '-' + row.driverPhone : '无主驾' }}
                                    </span>

                                </template>

                            </el-table-column>
                            <el-table-column width="120" property="companyName" label="所属单位" />
                            <el-table-column width="120" property="simpleDockedAddress" label="停靠点" />
                            <el-table-column property="lastDetails" label="上一单行程">
                                <template #="{ row, column, $index }">
                                    <span :style="row.lastOrderId ? 'color:red' : ''">{{ row.lastDetails }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="routeTime" label="最快到达" />
                            <el-table-column width="120" property="salaryBalance" label="月佣金" />
                            <el-table-column width="120" property="customerScoring" label="评分" />
                            <el-table-column property="nextDetails" label="下一单行程">
                                <template #="{ row, column, $index }">
                                    <span :style="row.orderId ? 'color:red' : ''">{{ row.nextDetails }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column width="120" property="remark" label="备注" />
                        </el-table>
                    </el-tab-pane>
                    <el-tab-pane label="线下派车" name="线下派车">
                        <div style="font-weight:700;font-size:20px;margin-bottom:20px;">
                            行程简称:{{ vehicles_data.routeSimpleName }}</div>
                        <el-form class="form_Css" :model="offlineDispatchCar_data" ref="offlineDispatchCar_ref"
                            :inline="true">
                            <el-form-item>
                                <el-select @change="carCompanyId_change" v-model="offlineDispatchCar_data.carCompanyId"
                                    :placeholder="'请选择线下车队'" style="width: 240px" filterable remote
                                    :filter-method="handleFilter">
                                    <el-option v-for="item in findComboCusList_list" :label="item.cusCompanyName"
                                        key="item.id" :value="item.id"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item>
                                <el-input style="width: 170px;" v-model="offlineDispatchCar_data.dispatchName"
                                    placeholder="请选择业务负责人" clearable />
                            </el-form-item>
                            <el-form-item>
                                <el-input style="width: 190px;" v-model="offlineDispatchCar_data.dispatchMobile"
                                    placeholder="请选择业务负责人手机号" clearable />

                            </el-form-item>

                            <el-form-item prop="plateNum" :rules="[
                                { required: true, message: '请输入车牌号', trigger: 'blur' },

                            ]">
                                <el-input v-model="offlineDispatchCar_data.plateNum" placeholder="车牌号"
                                    style="width: 120px;"></el-input>
                            </el-form-item>

                            <el-form-item prop="driverName" :rules="[
                                { required: true, message: '请输入师傅姓名', trigger: 'blur' },

                            ]">
                                <el-input v-model="offlineDispatchCar_data.driverName" placeholder="师傅姓名"
                                    style="width: 120px;"></el-input>
                            </el-form-item>

                            <el-form-item prop="driverPhone" :rules="[
                                { required: true, message: '请输入师傅电话', trigger: 'blur' },

                            ]">
                                <el-input maxlength="11" v-model="offlineDispatchCar_data.driverPhone"
                                    placeholder="师傅电话" style="width: 180px;"></el-input>
                            </el-form-item>


                            <el-form-item prop="outPrice" :rules="[
                                { required: true, message: '请输入派单价格', trigger: 'blur' },

                            ]">
                                <el-input type="number" maxlength="6" v-model="offlineDispatchCar_data.outPrice"
                                    placeholder="派单价格" style="width: 180px;">

                                    <template #append>元</template></el-input>
                            </el-form-item>
                            <el-form-item v-if="offlineDispatchCar_data_sendPriceTrust_off" prop="sendPriceTrust"
                                :rules="[
                                    { required: false, message: '请输入收款价格', trigger: 'blur' },

                                ]">
                                <el-input type="number" maxlength="6" v-model="offlineDispatchCar_data.sendPriceTrust"
                                    placeholder="收款价格" style="width: 180px;">

                                    <template #append>元</template></el-input>
                            </el-form-item>

                        </el-form>
                        <el-button style="margin-left:70vw" @click="filterCar_data_btn" type="primary">派车</el-button>
                    </el-tab-pane>
                </el-tabs>
            </div>


        </el-dialog>
        <!-- 修改线下派车 -->
        <el-dialog style="margin-top:5vh" v-model="xianxiaup_car_off" title="线下派车修改" width="83%"
            :close-on-click-modal='false'>
            <div>

                <!-- <div style="font-weight:700;font-size:20px;margin-bottom:20px;">
                    行程简称:{{ vehicles_data.routeSimpleName }}</div> -->
                <el-form class="form_Css" :model="xianxiaup_car_data" ref="offlineDispatchCar_ref" :inline="true">
                    <el-form-item>
                        <el-select @change="xianxiacarCompanyId_change" v-model="xianxiaup_car_data.carCompanyId"
                            :placeholder="'请选择线下车队'" style="width: 240px">
                            <el-option v-for="item in findComboCusList_list" :label="item.cusCompanyName" key="item.id"
                                :value="item.id"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" v-model="xianxiaup_car_data.dispatchName" placeholder="请选择业务负责人"
                            clearable />
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 190px;" v-model="xianxiaup_car_data.dispatchMobile"
                            placeholder="请选择业务负责人手机号" clearable />

                    </el-form-item>

                    <el-form-item prop="plateNum" :rules="[
                        { required: true, message: '请输入车牌号', trigger: 'blur' },

                    ]">
                        <el-input v-model="xianxiaup_car_data.plateNum" placeholder="车牌号"
                            style="width: 120px;"></el-input>
                    </el-form-item>

                    <el-form-item prop="driverName" :rules="[
                        { required: true, message: '请输入师傅姓名', trigger: 'blur' },

                    ]">
                        <el-input v-model="xianxiaup_car_data.driverName" placeholder="师傅姓名"
                            style="width: 120px;"></el-input>
                    </el-form-item>

                    <el-form-item prop="driverPhone" :rules="[
                        { required: true, message: '请输入师傅电话', trigger: 'blur' },

                    ]">
                        <el-input maxlength="11" v-model="xianxiaup_car_data.driverPhone" placeholder="师傅电话"
                            style="width: 180px;"></el-input>
                    </el-form-item>

                    <el-form-item prop="outPrice" :rules="[
                        { required: true, message: '请输入派单价格', trigger: 'blur' },

                    ]">
                        <el-input type="number" maxlength="6" v-model="xianxiaup_car_data.outPrice" placeholder="派单价格"
                            style="width: 180px;">

                            <template #append>元</template></el-input>
                    </el-form-item>
                    <el-form-item v-if="offlineDispatchCar_data_sendPriceTrust_off" prop="sendPriceTrust" :rules="[
                        { required: false, message: '请输入收款价格', trigger: 'blur' },

                    ]">
                        <el-input type="number" maxlength="6" v-model="xianxiaup_car_data.sendPriceTrust"
                            placeholder="收款价格" style="width: 180px;">

                            <template #append>元</template></el-input>
                    </el-form-item>






                </el-form>
                <el-button style="margin-left:70vw" @click="xianxiafilterCar_data_btn" type="primary">修改</el-button>


            </div>


        </el-dialog>
        <!-- 修改车辆 -->
        <el-dialog style="margin-top:5vh" v-model="up_car_off" title="修改订单车辆" width="83%" :close-on-click-modal='false'>
            <div>
                <el-form class="form_Css" :inline="true">
                    <el-form-item>
                        <div style="font-weight:700">订单起止日期:</div>
                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_car_data.stime" type="datetime" placeholder="开始日期" />

                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_car_data.etime" type="datetime" placeholder="结束日期" />
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" type="number" v-model="up_car_data.geSeats" placeholder="座位数"
                            clearable>

                            <template #append>座</template>
                        </el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" v-model="up_car_data.plateNum" placeholder="车牌号" clearable />
                    </el-form-item>
                    <!-- <el-form-item>
                        <el-input style="width: 170px;" v-model="up_car_data.orderNum" placeholder="订单号" clearable />
                    </el-form-item> -->

                    <el-form-item>
                        <el-select v-model="up_car_data.force" :placeholder="'强制查询'" style="width: 120px">
                            <el-option :label="'非强制'" value="0"></el-option>
                            <el-option :label="'强制查询(忽略时间冲突)'" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_car_find" type="primary">搜索</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_car_ok_btn" type="primary">确认修改</el-button>
                    </el-form-item>
                </el-form>
                <el-tag style="margin-bottom:10px;" type="primary">当钱车辆:{{ up_car_e.plateNum }}({{ up_car_e.needSeats ?
                    up_car_e.needSeats : '不限' + '人' }})</el-tag>

                <el-table @selection-change="up_car_selection_change_btn" :data="up_car_list" border fit :height="550"
                    style="width: 100%;margin-bottom: 20px;">
                    <el-table-column type="selection" width="35" />
                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column width="120" property="seats" label="座位数" />

                    <el-table-column width="200" property="plateNum" label="车牌号">

                        <template #="{ row, column, $index }">
                            {{ row.plateNum }} <span v-if="row.isRestricted" style="color:Red">(限号)</span><br>

                        </template>
                    </el-table-column>
                    <el-table-column width="200" property="plateNum" label="驾驶员">

                        <template #="{ row, column, $index }">
                            {{ row.driverName ? row.driverName + '-' + row.driverPhone : '' }}

                        </template>
                    </el-table-column>



                </el-table>
            </div>
        </el-dialog>
        <!-- 修改驾驶员 -->
        <el-dialog style="margin-top:5vh" v-model="up_driver_off" title="修改订单驾驶员" width="83%"
            :close-on-click-modal='false'>
            <div>
                <el-form class="form_Css" :inline="true">
                    <el-form-item>
                        <div style="font-weight:700">订单起止日期:</div>
                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_driver_data.stime" type="datetime" placeholder="开始日期" />

                    </el-form-item>
                    <el-form-item>
                        <el-date-picker value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
                            v-model="up_driver_data.etime" type="datetime" placeholder="结束日期" />
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width: 170px;" v-model="up_driver_data.driverInfo" placeholder="驾驶员姓名或电话"
                            clearable />
                    </el-form-item>

                    <el-form-item>
                        <el-input style="width: 170px;" v-model="up_driver_data.orderNum" placeholder="订单号" clearable />
                    </el-form-item>

                    <el-form-item>
                        <el-select v-model="up_driver_data.force" :placeholder="'强制查询'" style="width: 120px">
                            <el-option :label="'非强制'" value="0"></el-option>
                            <el-option :label="'强制查询(忽略时间冲突)'" value="1"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_driver_find" type="primary">搜索</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-button style="margin-left:20px" @click="up_driver_ok_btn" type="primary">确认修改</el-button>
                    </el-form-item>
                </el-form>
                <el-tag style="margin-bottom:10px;font-weight:700" type="primary">当前驾驶员:{{ up_driver_e.driverName }}-{{
                    up_driver_e.driverPhone }}</el-tag>

                <el-table @selection-change="up_driver_change_btn" :data="up_driver_list" border fit :height="550"
                    style="width: 100%;margin-bottom: 20px;">
                    <el-table-column type="selection" width="35" />
                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column width="120" property="companyNum" label="单位编号" />
                    <el-table-column width="120" property="driverName" label="驾驶员" />
                    <el-table-column width="120" property="driverPhone" label="驾驶员电话" />
                    <el-table-column width="120" property="driveType" label="准驾车型" />
                    <el-table-column width="150" property="takeDriveTime" label="驾驶员证领证时间" />
                    <el-table-column width="150" property="takeDriveAddTime" label="驾驶证增驾时间" />
                    <el-table-column width="150" property="takeDriveExpireTime" label="驾驶证换证时间" />
                    <el-table-column width="150" property="certificateType" label="资格证证件类型" />
                    <el-table-column width="150" property="certificateDriveType" label="资格证准驾车型" />
                    <el-table-column width="120" property="certificateNum" label="资格证号" />
                    <el-table-column width="150" property="takeCertificateTime" label="资格证领证时间" />
                    <el-table-column width="150" property="certificateExpireTime" label="资格证换证时间" />
                </el-table>
            </div>

        </el-dialog>
        <!-- 异常报备 -->
        <el-dialog style="margin-top:5vh" v-model="accidentRecord_off" title="异常报备" width="83%"
            :close-on-click-modal='false'>
            <el-table size="medium" border height="500" :row-style="{ height: '100px' }"
                :header-cell-style="{ height: '35px' }" :data="accidentRecord_list">
                <el-table-column property="accidentName" label="报备名称" height="50" width="180"></el-table-column>
                <el-table-column property="accidentContent" label="报备内容" width="200"></el-table-column>
                <el-table-column property="accidentNote" label="报备备注"></el-table-column>
                <el-table-column property="addTime" label="报备时间" width="180"></el-table-column>
                <el-table-column label="报备图片" width="120">

                    <template #="{ row, column, $index }">


                        <el-image :preview-src-list="['https://cba360.com' + row.accidentUrl]" v-if="row.accidentUrl"
                            style="width: 100px; height: 100px" :src="'https://cba360.com' + row.accidentUrl"
                            fit="cover"></el-image>
                        <p v-else style="text-align: center;">无</p>

                    </template>
                </el-table-column>
                <el-table-column label="调度异常处理">

                    <template #="{ row, column, $index }">

                        <el-button v-if="row.serviceDisposeContent == '未处理'" type="danger"
                            @click.native="disposeAccident_btn(row)">
                            未处理
                        </el-button>
                        <div v-if="row.serviceDisposeContent != '未处理'">内容:{{ row.serviceDisposeContent }}</div>
                        <div v-if="row.serviceDisposeContent != '未处理'">时间:<span style="color: red;">{{
                            row.serviceDisposeTime }}</span>
                        </div>
                        <el-button v-if="row.serviceDisposeContent != '未处理'" type="success"
                            @click.native="disposeAccident_btn(row)">
                            修改
                        </el-button>


                    </template>
                </el-table-column>
                <el-table-column label="旅行社异常处理">

                    <template #="{ row, column, $index }">

                        <div style="color: red;" v-if="row.travelDisposeContent == '未处理'">
                            未处理
                        </div>
                        <div v-if="row.travelDisposeContent != '未处理'">内容:{{ row.travelDisposeContent }}</div>
                        <div v-if="row.travelDisposeContent != '未处理'">时间:<span style="color: red;">{{
                            row.travelDisposeTime }}</span>
                        </div>
                        <!-- <el-button v-else-if="row.travelDisposeContent != '未处理'" type="success"
                  @click.native="travelDisposeContent_btn(row)">
                  已处理
                </el-button> -->


                    </template>
                </el-table-column>
            </el-table>

        </el-dialog>
        <el-dialog title="处理异常报备" v-model="disposeAccident_off" width="430px">
            <el-input type="textarea" autosize placeholder="请输入内容" v-model="disposeAccidentContent">
            </el-input>


            <template #footer>
                <div class="dialog-footer">
                    <el-button @click="disposeAccident_off = false">取 消</el-button>
                    <el-button type="primary" @click="disposeAccident_data">确 定</el-button>
                </div>
            </template>

        </el-dialog>
        <!-- 投诉处理 -->

        <el-dialog style="margin-top:5vh" v-model="adupRewardPunish_off" title="投诉处理:" width="40%"
            :close-on-click-modal='false'>
            <el-form :model="adupRewardPunish_data" label-width="auto" style="max-width: 600px">
                <el-form-item label="驾驶员:">
                    <el-select style="width: 220px;" v-model="adupRewardPunish_data.driverUserId" placeholder="请选择驾驶员">
                        <el-option v-for="item in getDriverCombo_list" :key="item.id" :label="item.realName"
                            :value="item.ftUserId" />
                    </el-select>
                </el-form-item>
                <el-form-item label="类型选择:">
                    <el-select style="width: 220px;" v-model="adupRewardPunish_data.rewardPunishType"
                        placeholder="请选择类型">
                        <el-option label="投诉" value="0" />
                        <el-option label="表扬" value="1" />
                        <el-option label="委屈" value="2" />
                    </el-select>
                </el-form-item>
                <el-form-item label="奖惩内容:">
                    <el-input show-word-limit maxlength="200" :rows="3" type="textarea"
                        :autosize="{ minRows: 2, maxRows: 10 }" placeholder="请输入奖惩内容"
                        v-model="adupRewardPunish_data.content" />
                </el-form-item>
                <el-form-item label="奖惩流程:">
                    <el-input show-word-limit maxlength="200" :rows="3" type="textarea"
                        :autosize="{ minRows: 2, maxRows: 10 }" placeholder="请输入奖惩流程"
                        v-model="adupRewardPunish_data.flowPath" />
                </el-form-item>
                <!-- :show-file-list="false" -->
                <div>
                    <el-form-item v-if="adupRewardPunish_data.id" label="奖惩证明图片:">

                        <div class="demo-image__preview" v-for="item in adupRewardPunish_rawFile_list">
                            <el-image style="width: 100px; height: 100px" :src="ImageUrl + item" :zoom-rate="1.2"
                                :max-scale="7" :min-scale="0.2" :preview-src-list="[ImageUrl + item]" :initial-index="4"
                                fit="cover" />
                        </div>
                    </el-form-item>
                    <el-form-item v-else label="奖惩证明图片:">
                        <div style="display: flex;    justify-content: space-evenly;">
                            <el-upload style="margin-top: 10px;" class="avatar-uploader" :action="ImageUrl_upload"
                                :headers="{ token: GET_TOKEN() }"
                                :data="{ ftype: 'REWARD_PUNISH_IMG', files: rawFile_list2 }" list-type="picture-card"
                                :on-remove="handleRemove" :on-preview="handlePictureCardPreview"
                                :on-success="handleAvatarSuccess2" :before-upload="beforeAvatarUpload2">

                                <el-icon class="avatar-uploader-icon">
                                    <Plus />
                                </el-icon>
                            </el-upload>
                            <el-dialog v-model="dialogVisible">
                                <div style="width:60vh;height:60vh;margin:auto;">
                                    <img style="width:60vh;height:60vh;margin:auto;" :src="ImageUrl + dialogImageUrl"
                                        alt="Preview Image" />
                                </div>
                            </el-dialog>
                        </div>
                    </el-form-item>


                </div>

                <el-form-item :label="adupRewardPunish_data.rewardPunishType == 0 ? '驾驶员承担赔偿金额:' : '驾驶员奖励金额'">
                    <el-input type="number" v-model="adupRewardPunish_data.driverIndemnityPrice"
                        placeholder="驾驶员承担赔偿金额">
                        <template #append>元</template>
                    </el-input>
                </el-form-item>
                <el-form-item label="驾驶员处罚金额:" v-if="adupRewardPunish_data.rewardPunishType == 0">
                    <el-input type="number" v-model="adupRewardPunish_data.driverPunishPrice" placeholder="驾驶员处罚金额">
                        <template #append>元</template>
                    </el-input>
                </el-form-item>
                <el-row>
                    <el-col :span="12"> <el-form-item label="公司赔偿金额:"
                            v-if="adupRewardPunish_data.rewardPunishType == 0">
                            <el-input type="number" v-model="adupRewardPunish_data.indemnityPrice" placeholder="公司赔偿金额">
                                <template #append>元</template>
                            </el-input>
                        </el-form-item></el-col>
                    <el-col :span="12"> <el-form-item label="扣款方式:" v-if="adupRewardPunish_data.rewardPunishType == 0">
                            <el-select style="width: 220px;" v-model="adupRewardPunish_data.payWay"
                                placeholder="请选择扣款方式">
                                <el-option label="订单内扣款" value="0" />
                                <el-option label="现金支付" value="1" />
                            </el-select>
                        </el-form-item></el-col>
                </el-row>


            </el-form>
            <div>

                <div style="margin-left:28vw" v-if="adupRewardPunish_data.id">
                    <el-button type="danger" @click="delRewardPunish_btn">删 除</el-button>
                    <el-button type="warning" @click="adupRewardPunishBtn">修 改</el-button>
                </div>
                <el-button v-else style="margin-left:33vw" type="primary" @click="adupRewardPunishBtn">确 定</el-button>
            </div>

        </el-dialog>
        <el-dialog style="margin-top:5vh" v-model="orderNum_off" :title="orderNum_num" width="45%"
            :close-on-click-modal='false'>
            <div>
                <el-table border height="67vh" ref="multipleTableRef" :data="orderNum_list" style="width: 100%">

                    <el-table-column label="编号" width="55" fixed type="index" />
                    <el-table-column prop="operUserId" label="操作人" width="180" />
                    <el-table-column prop="addTime" label="操作时间" width="180" />
                    <el-table-column label="操作状态" width="180">
                        <template #default="scope">
                            <span>{{ scope.row.status ? scope.row.status : '无' }}</span>
                        </template>
                    </el-table-column>

                    <el-table-column label="操作备注" width="180">
                        <template #default="scope">
                            <el-tooltip placement="left" :popper-class="'route-tips'">
                                <template #content>{{ scope.row.operNote ? scope.row.operNote : '无' }}</template>
                                <span style="  width: 100px; white-space: nowrap; text-overflow: ellipsis; ">
                                    {{ scope.row.operNote ? scope.row.operNote : '无' }}</span>
                            </el-tooltip>

                        </template>
                    </el-table-column>


                </el-table>
            </div>

            <div style="margin-top:20px">
                <el-pagination @current-change="current_change_btn2" @size-change="size_change_btn2"
                    v-model:current-page="orderNum_find.page.pageNum" v-model:page-size="orderNum_find.page.pageSize"
                    :page-sizes="[20, 30, 50, 100]" :background="true"
                    layout="prev, pager, next, jumper,->,sizes,total," :total="total2" />
            </div>

        </el-dialog>

        <!--第一个叫收款价格，第二个叫外调价格  -->

        <el-dialog style="margin-top:5vh" v-model="sendPriceTrust_off" title="价格:" width="30%"
            :close-on-click-modal='false'>
            <el-form :model="sendPriceTrust_data" label-width="auto" style="max-width: 400px">
                <el-form-item label="收款价格:">
                    <el-input type="number" v-model="sendPriceTrust_data.sendPriceTrust" placeholder="收款价格">
                        <template #append>元</template>
                    </el-input>
                </el-form-item>
                <el-form-item v-if="sendPriceTrust_num == 2" label="外调价格:">
                    <el-input type="number" v-model="sendPriceTrust_data.sendPriceOther" placeholder="外调价格">
                        <template #append>元</template>
                    </el-input>
                </el-form-item>




            </el-form>
            <div>


                <el-button style="margin-left:23vw" type="primary" @click="sendPriceTrust_ok_btn">确 定</el-button>
            </div>

        </el-dialog>

        <uporder v-if="up_off" @myClick="upCarMd" :data="up_off" :id="up_id"></uporder>
        <copyorder v-if="copy_off" @myClick="copyCarMd" :data="copy_off" :id="copy_id"></copyorder>
    </div>
</template>

<script setup>
import Sortable from 'sortablejs';
import { GET_TOKEN } from '@/utils/token.js'
import { ref, reactive, onMounted, computed, watch } from 'vue'
import {
    adupPrivateSet, getPrivateSetList, getOrderProcessList, omsorderdelete, cancelDispatchCar, mergeProcess, merge,
    setHelpGathUrl, isUseDidi, findCarCombo, filterCar2, findComboCusList, offlineDispatchCar, confirmGrabOrder, dispatchCarPop,
    filterOrder, cancelMergeProcess, confirmSendOrder, JLConfirmSend, findCanUseCar, findCanUseDriver, changeDriver, changeCar,
    changeUnder, getServiceMans, disposeAccident, finishUnderOrder, cancelGathLock, adupRewardPunish, getRewardPunishById, delRewardPunish,
    getCarConfigurationType, findOrderScheduleByOrderNum, receiveOrRefuse, findTrusteeshipMeCombo, getOrderReadyList


} from '@/api/original_order_list.js'
import {
    getDriverCombo,

} from '@/api/human_resources_center.js'

import { ElMessage, ElLoading, ElMessageBox, ElNotification } from 'element-plus'
import { importCusCheckInData, ImageUrl_upload, ImageUrl, line2treeData } from '@/utils/common.js'
import CircularJSON from 'circular-json'
// import uporder from './up.vue'
// import copyorder from './copy.vue'
import uporder from './up/index.vue'
import copyorder from './copy/index.vue'
import { useRouter, useRoute } from 'vue-router'
const $useRouter = useRouter()
const $useRoute = useRoute()
import mainStore from '@/store/main/index.js'
let $mainStore = mainStore()
onMounted(async () => {
    // let order_follow_up = JSON.parse(localStorage.getItem('order_follow_up'))
    // if (order_follow_up) {
    //     find_data.find = order_follow_up.find
    // }

    getPrivateSetList({
        find: '订单跟进',
        page: {
            pageNum: 1,
            pageSize: 20,
        },
    }).then(res => {
        if (res.data.list[0]) {
            table_data_list_new.value = JSON.parse(res.data.list[res.data.list.length - 1].dat)
        } else {

            table_data_list_new.value = table_data_list
        }
    })


    Sortable.create(sortableContainer.value, {
        draggable: '.drag_it',
        ghostClass: 'sortable-ghost',
        onEnd: evt => {
            const targetRow = table_data_list_new.value.splice(evt.oldIndex, 1)[0];
            table_data_list_new.value.splice(evt.newIndex, 0, targetRow);
        }
    })



    getOrderReadyList_api()

    findComboCusList({
        page: {
            pageNum: 1,
            pageSize: 999,
        },

        cusTypeMark: 'CARTEAM',

    }).then(res => {
        findComboCusList_list.value = res.data
        findComboCusList_list2.value = res.data
    })
    getServiceMans({

    }).then(res => {
        if (res.code == 1) {
            getServiceMans_list.value = res.data;

        }
    })

    findComboCusList({
        page: {
            pageNum: 1,
            pageSize: 999,
        },



    }).then(res => {
        findComboCusList_list_yongche.value = res.data
        findComboCusList_list_yongche2.value = res.data
    })

    findTrusteeshipMeCombo({
        page: {
            pageNum: 1,
            pageSize: 999,
        },
        companyName: '',
    }).then(res => {
        findTrusteeshipMeComboList.value = res.data || [];
        let luser = JSON.parse(localStorage.getItem("luser"))
        let luser_companyNum = luser.companyNum
        let companyNums = [luser_companyNum]
        if (res.data) {
            for (let i = 0; i < res.data.length; i++) {

                companyNums.push(res.data[i].companyNum)
            }
        }
        findCarCombo({
            page: {
                pageNum: 1,
                pageSize: 999,
            },
            plateNum: '',
            companyNums: companyNums,
        }).then(res => {

            carNumList.value = res.data.list || [];
        })
    })

    getDriverCombo({
        page: {
            pageNum: 1,
            pageSize: 999,
        },
        plateNum: '',
    }).then(res => {
        getDriverCombo_list.value = res.data
    })
    timeTypeTime.value = [new_day(), to_day()]
    find_data.stime = new_day()
    find_data.etime = to_day()
    // let luser = JSON.parse(localStorage.getItem("luser"))
    // let luser_companyNum = luser.companyNum
    // companyNums.value = [luser_companyNum]
    setTimeout(() => {
        for (let i = 0; i < findTrusteeshipMeComboList.value.length; i++) {
            companyNums.value.push(findTrusteeshipMeComboList.value[i].companyNum)
        }
        checkAll.value = true
        list_api()
    }, 500);

    company.value = JSON.parse(localStorage.getItem("company"))
    isTrustee.value = company.value.isTrustee



})

const checkAll = ref(false)
const indeterminate = ref(false)
const checkAll2 = ref(false)
const indeterminate2 = ref(false)
const findTrusteeshipMeComboList = ref([])
const companyNums = ref([])
const companyNums2 = ref([])
watch(companyNums, (val) => {

    if (val.length === 0) {
        checkAll.value = false
        indeterminate.value = false
    } else if (val.length === findTrusteeshipMeComboList.value.length) {
        checkAll.value = true
        indeterminate.value = false
    } else {
        indeterminate.value = true
    }
})
const handleCheckAll = (val) => {
    indeterminate.value = false
    if (val) {
        companyNums.value = findTrusteeshipMeComboList.value.map((_) => _.companyNum)
    } else {
        companyNums.value = []
    }

}
watch(companyNums2, (val) => {

    if (val.length === 0) {
        checkAll2.value = false
        indeterminate2.value = false
    } else if (val.length === findTrusteeshipMeComboList.value.length) {
        checkAll2.value = true
        indeterminate2.value = false
    } else {
        indeterminate2.value = true
    }
})
const handleCheckAll2 = (val) => {
    indeterminate2.value = false
    if (val) {
        companyNums2.value = findTrusteeshipMeComboList.value.map((_) => _.companyNum)
    } else {
        companyNums2.value = []
    }

}
//#region 是否托管
const company = ref({})
const isTrustee = ref(0)
//#endregion

// #region 异常报备
const getDriverCombo_list = ref([])
const accidentRecord_id = ref('')
const accidentRecord_off = ref(false)
const accidentRecord_list = ref([])
const disposeAccident_off = ref(false)
const disposeAccidentContent = ref('')
const serviceDisposeTime = ref('')
const disposeAccident_list = reactive({
    accidentIndex: '',
    id: '',
    serviceDisposeTime: '',
})
const accidentRecord_btn = (e) => {
    accidentRecord_list.value = e.accidentList
    accidentRecord_id.value = e.id
    accidentRecord_off.value = true

}
const disposeAccident_btn = (e) => {
    console.log(e)
    let date = new Date()
    let y = date.getFullYear()
    let m = date.getMonth()
    let d = date.getDate();
    m = (m > 9) ? m : ("0" + m);
    d = (d < 10) ? ("0" + d) : d;
    let hours = date.getHours();
    let minutes = date.getMinutes();
    minutes = minutes < 10 ? '0' + minutes : minutes;
    let seconds = date.getSeconds();
    seconds = seconds < 10 ? '0' + seconds : seconds;
    let inTime = hours + ':' + minutes + ':' + seconds;
    let time = y + '-' + m + '-' + d + ' ' + inTime
    disposeAccident_off.value = true
    disposeAccident_list.id = accidentRecord_id.value
    disposeAccident_list.accidentIndex = e.accidentIndex,
        disposeAccident_list.serviceDisposeTime = time
    disposeAccidentContent.value = e.serviceDisposeContent
    serviceDisposeTime.value = e.serviceDisposeTime
}
const disposeAccident_data = () => {
    let ps = {
        accidentIndex: disposeAccident_list.accidentIndex,
        disposeAccidentContent: disposeAccidentContent.value,
        id: accidentRecord_id.value,
        serviceDisposeTime: disposeAccident_list.serviceDisposeTime
    }
    disposeAccident(ps).then(res => {
        if (res.code == 1) {
            list_api()

            disposeAccident_off.value = false
            accidentRecord_off.value = false
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }

    })
}
//#endregion
// #region 点击订单号操作
const orderNum_off = ref(false)
const orderNum_num = ref('')
const orderNum_list = ref([])
const orderNum_find = ref({
    page: {
        pageNum: 1,
        pageSize: 20,
    },
    orderNum: '',
})
const total2 = ref(0)
const orderNum_btn = (e) => {
    orderNum_num.value = '订单号：' + e.orderNum
    orderNum_find.value.orderNum = e.orderNum
    findOrderScheduleByOrderNumapi()


    orderNum_off.value = true
}
const findOrderScheduleByOrderNumapi = () => {
    findOrderScheduleByOrderNum(orderNum_find.value).then(res => {
        orderNum_list.value = res.data.list
        total2.value = res.data.total
    })
}
const current_change_btn2 = () => {
    findOrderScheduleByOrderNumapi()
}
const size_change_btn2 = () => {
    orderNum_find.page.pageNum = 1
    list_api()
}
//#endregion
// #region 表格样式
const cellStyle = ({ row, column, rowIndex, columnIndex }) => {

    if (column.label == '车型' && row.regularCarMoney > 0) {
        return { 'border': '2px solid red' };
    } else if (column.label == '订单状态' && row.isUseDidi == 1) {
        return { 'border': '2px solid red' };
    }
}
const cellStyle2 = ({ row, column, rowIndex, columnIndex }) => {

    if (column.label == '驾驶员' && row.leaveDetails) {
        return { 'border': '2px solid red' };
    }
}
const rowStyle = ({ row, rowIndex }) => {
    let status = row.status
    // let regularCar = row.regularCar
    // if (regularCar == 1) {
    //   console.log(row)
    // }


    if (status == 'READY_CAR') {
        // 未派车=行背景为：白色 黑字
        return { 'background': '#ffffff', 'color': '#000000', 'font-weight': '600' };
    } else if (status == 'CAR_READY_CONFIRME') {
        // 未通知（已预派）=行背景：粉红 黑字 
        return { 'background': '#FBAEAA', 'color': '#000000', 'font-weight': '600' };
    } else if (status == 'DRIVER_READY_RECEIVE') {
        // 师傅未确认(即已通知)=行背景为：蓝色
        return { 'background': '#a9befd', 'color': '#000000', 'font-weight': '600' };
    } else if (status == 'READY_ROAD') {
        // 师傅已确认=行背景为：深绿色 白字
        return { 'background': '#045155', 'color': '#000000', 'font-weight': '600' };
    } else if (status == 'ON_ROADING') {
        // 已出行（即运行中）=行背景为：绿色
        return { 'background': '#a1d28a', 'color': '#000000', 'font-weight': '600' };
    }
    else if (status == 'DRIVER_CONFIRMED') {
        //#045155
        return { 'background': '#045155', 'color': '#fff', 'font-weight': '600' };
    }
    else if (status == 'FINISHED') {
        // 已完团=行背景为：橙色
        return { 'background': 'rgb(201 122 122)', 'color': '#000000', 'font-weight': '600' };
    } else if (status == 'START_TAKE_CUS') {
        // 已完团=行背景为：橙色
        return { 'background': '#FDCAA9', 'color': '#fff', 'font-weight': '600' };
    }

    // 任何状态下，只要价格为0，即为：未定价
    if (row.price == 0) {
        // 没有价格=行背景为：红色
        return { 'background': '#EEBE77', 'color': '#000000', 'font-weight': '600' };
    }

    return {};
}
// #endregion
const findComboCusList_list_yongche = ref([])
const findComboCusList_list_yongche2 = ref([])
const dutyService_list = ref([])
const findComboCusList_list_handleFilter = (value) => {
    // 自定义筛选逻辑
    if (value) {
        let results = findComboCusList_list_yongche2.value.filter(item => {
            for (let key in item) {
                if (typeof item[key] === 'string' && item[key].includes(value)) {
                    return true;
                }
            }
            return false;
        })
        if (results.length > 0) {
            findComboCusList_list_yongche.value = results
        } else {
            findComboCusList_list_yongche.value = []
        }
    } else {
        findComboCusList_list_yongche.value = findComboCusList_list_yongche2.value
    }
}

const handleFilter = (value) => {
    // 自定义筛选逻辑
    if (value) {
        let results = findComboCusList_list2.value.filter(item => {
            for (let key in item) {
                if (typeof item[key] === 'string' && item[key].includes(value)) {
                    return true;
                }
            }
            return false;
        })
        if (results.length > 0) {
            findComboCusList_list.value = results
        } else {
            findComboCusList_list.value = []
        }
    } else {
        findComboCusList_list.value = findComboCusList_list2.value
    }
}


const cusCompanySimpleName_change = (e) => {
    for (let i = 0; i < findComboCusList_list_yongche2.value.length; i++) {

        if (e == findComboCusList_list_yongche2.value[i].userId) {
            let data = findComboCusList_list_yongche2.value[i].dutyService.split(',')
            dutyService_list.value = []
            console.log(data)

            for (let j = 0; j < data.length; j++) {
                let obj = {}
                obj.id = data[j].split('-')[0]
                obj.name = data[j].split('-')[1]
                obj.phone = data[j].split('-')[2]
                dutyService_list.value.push(obj)
            }
        }
    }
}
const findComboCusList_list = ref([])
const findComboCusList_list2 = ref([])
const dutyService_list2 = ref([])

const carCompanyId_change2 = (e) => {
    console.log(e)
    for (let i = 0; i < findComboCusList_list.value.length; i++) {
        if (e == findComboCusList_list.value[i].id) {
            let data = findComboCusList_list.value[i].dutyService.split(',')
            dutyService_list2.value = []
            console.log(data)

            for (let j = 0; j < data.length; j++) {
                let obj = {}
                obj.id = data[j].split('-')[0]
                obj.name = data[j].split('-')[1]
                obj.phone = data[j].split('-')[2]
                dutyService_list2.value.push(obj)
            }
        }
    }
}


// 行程简称
const routeSimpleName_list = reactive([
    {
        value: '送天府',
        label: '送天府',
    },
    {
        value: '接天府',
        label: '接天府',
    },
    {
        value: '拼车送天府',
        label: '拼车送天府',
    },
    {
        value: '拼车接天府',
        label: '拼车接天府',
    },
    {
        value: '送双流',
        label: '送双流',
    },
    {
        value: '接双流',
        label: '接双流',
    },
    {
        value: '送东站',
        label: '送东站',
    },
    {
        value: '接东站',
        label: '接东站',
    },
    {
        value: '送西站',
        label: '送西站',
    },
    {
        value: '接西站',
        label: '接西站',
    },
    {
        value: '送南站',
        label: '送南站',
    },
    {
        value: '接南站',
        label: '接南站',
    }, {
        value: '送集合点大巴',
        label: '送集合点大巴',
    },
    {
        value: '接集合点大巴',
        label: '接集合点大巴',
    },
])
// 合并标识
const isMerge_list = reactive([
    {
        value: 'true',
        label: '合并',
    },
    {
        value: 'false',
        label: '未合并',
    },
])


//#region 表格数据处理
const price_api = (e) => {
    let data = ''
    if (e.grabPrice > 0) {
        data = e.grabPrice
    } else {
        data = e.price
    }
    return data
}
const price_api2 = (e) => {
    let data = 0
    if (e.pointMoney > 0) {
        data += Number(e.pointMoney)
    }
    if (e.couponMoney > 0) {
        data += Number(e.couponMoney)
    }

    return data = '/抵' + data
}
const table_data_list = reactive([
    { label: '行程简称', field: 'routeSimpleName', width: 150, off: true },
    { label: "订单状态", field: "status", width: 200, off: true },

    { label: "车型", field: "needSeats", width: 140, off: true },
    { label: "已派车辆", field: "plateNum", width: 125, off: true },
    { label: "驾驶员", field: "driverName", width: 185, off: true },
    { label: "人数", field: "personNum", width: 60, off: true },
    { label: '订单价格', field: 'price', width: 100, off: true },
    // { label: '应付余额', field: 'pricealGathPrice', width: 100, off: true },
    { label: "合并标记", field: "groupNum", width: 90, off: true },
    { label: '行程详情', field: 'details', width: 700, off: true },
    { label: '客户', field: 'cusName', width: 160, off: true },
    { label: '客户备注', field: 'remark', width: 700, off: true },
    { label: '驾驶员备注', field: 'driverRemark', width: 700, off: true },
    { label: '业务员备注', field: 'serviceManRemark', width: 220, off: true },
    // { label: "异常报备", field: "accidentList", width: 100, off: true },
    { label: '订单号', field: 'orderNum', width: 130, off: true },
    { label: "百推订单", field: "baituiSignatoryPhone", width: 180, off: true },
    { label: '业务员', field: 'persons', width: 160, off: true },
    { label: '航班车次', field: 'flightNum', width: 120, off: true },
    { label: '用车单位', field: 'useCarCompanyId', width: 220, off: true },
    { label: '用车负责人', field: 'useCarDutyInfo', width: 220, off: true },
    { label: '供车单位', field: 'carCompanyName', width: 220, off: true },
    { label: '供车负责人', field: 'carDutyUserInfo', width: 220, off: true },
    { label: '出发日期', field: 'startDate', width: 120, off: true },
    { label: '出发时间', field: 'startTime', width: 100, off: true },
    { label: '到达日期', field: 'endDate', width: 120, off: true },
    { label: '到达时间', field: 'endTime', width: 100, off: true },
    { label: '添加时间', field: 'addTime', width: 175, off: true },





])

const table_data_list_new = ref([])
const icon_off = ref(false)
// 创建排序容器的引用
const sortableContainer = ref('')

const icon_btn = () => {
    icon_off.value = !icon_off.value
    console.log(sortableContainer.value)

}
const resetTableSet = () => {
    console.log(table_data_list)
    table_data_list_new.value = JSON.parse(JSON.stringify(table_data_list))
    console.log(table_data_list)
    console.log(table_data_list_new.value)
}
const saveTableSet = () => {
    adupPrivateSet({
        dat: JSON.stringify(table_data_list_new.value),
        tbName: '订单跟进',
        tbNum: "order_follow_up",
    }).then(res => {
        if (res.code == 1) {
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
    icon_off.value = false
}

const checkbox_btn = (e, c) => {
    for (let i = 0; i < table_data_list_new.value.length; i++) {
        if (table_data_list_new.value[i].label == c.target._value) {
            table_data_list_new.value[i].off == e

        }

    }

}

const sortedItems = computed(() => {
    return [...table_data_list_new.value].sort((a, b) => a.id - b.id);
})
//#endregion



//#region 分页列表
const getServiceMans_list = ref([])
const list_data = ref([])
const new_day = () => {
    let today = new Date();

    let year = today.getFullYear();
    let month = today.getMonth() + 1; // 月份是从 0 到 11，所以需要加上 1
    let day = today.getDate();

    // 如果月份或日期小于 10，则在前面补零
    if (month < 10) {
        month = '0' + month;
    }

    if (day < 10) {
        day = '0' + day;
    }

    let formattedDate = `${year}-${month}-${day} 00:00:00`;
    return formattedDate
}
const to_day = () => {
    // 创建当前日期时间对象
    let today = new Date();

    // 将日期调整到明天
    today.setDate(today.getDate() + 1);

    // 设置时间为上午10点
    today.setHours(23, 59, 59, 59);

    // 获取年、月、日、小时、分钟和秒
    let year = today.getFullYear();
    let month = String(today.getMonth() + 1).padStart(2, '0');
    let day = String(today.getDate()).padStart(2, '0');
    let hours = String(today.getHours()).padStart(2, '0');
    let minutes = String(today.getMinutes()).padStart(2, '0');
    let seconds = String(today.getSeconds()).padStart(2, '0');

    // 格式化日期时间
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
const defaultTime = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]
const timeTypeTime = ref([])
const timeTypeTime_btn = (e) => {
    if (e) {
        timeTypeTime.value = e
        find_data.stime = timeTypeTime.value[0]
        find_data.etime = timeTypeTime.value[1]
        find_data.timeType = '0'
    } else {
        timeTypeTime.value = ''
        find_data.stime = ''
        find_data.etime = ''
        find_data.timeType = ''
    }
}

const orderStates = ref([
    { id: "READY_CAR", name: "未派车" },
    { id: "CAR_READY_CONFIRME", name: "未通知" },
    { id: "DRIVER_READY_RECEIVE", name: "已通知" },
    { id: "DRIVER_CONFIRMED", name: "师傅已确认" },
    { id: "ON_ROADING", name: "已出行" },
    { id: "FINISHED", name: "已完成" },
    { id: "CANCELED", name: "已取消" },
    { id: "REFUSED", name: "已拒绝" },
    { id: "START_TAKE_CUS", name: "出发去接客户" },
    { id: "DELETE", name: "已删除" },
    //     { id: "PENDING", name: "已待定" },
    //     { id: "GRAB_SUCCESS", name: "抢单成功" },
    //     { id: "TRANS_SUCCESS", name: "转接成功" },

])
// const serviceTypes = ref([
//     { val: "", label: "业务类型（全部）" },
//     { val: "COUNTY_SER", label: "县际业务" },
//     { val: "CITY_SER", label: "市际业务" },
//     { val: "PROVINCE_SER", label: "省际业务" },
// ])

const find_data = reactive({
    page: {
        pageNum: 1,
        pageSize: 100,
    },
    routeSimpleName: '',
    // useCarCompanyId: '',
    // personNum: '',
    // startTime: '',
    // find: '',
    // shareMobile: '',
    // isMerge: '',

    serviceMan: '',
    timeType: '0',
    stime: '',
    etime: '',
    orderByCondition: '0',
    orderNum: '',
    details: '',
    statusList: [],
    // serviceType: '',
    needSeats: '',
    plateNum: '',
    driverName: '',
    userId: '',
    useCarDutyUserId: '',
    carCompanyId: '',
    carDutyUserId: '',
    companyNums: [],
    externalTransfer: '',
    type: '',
})
const total = ref(0)

// 分页器一夜显示多少数据页面
const size_change_btn = () => {
    find_data.page.pageNum = 1
    list_api()
}

// 分页器跳转页面
const current_change_btn = () => {
    list_api()
}
const totalAlGathPrice = ref(0)
const totalAlPayPrice = ref(0)
const totalDriverConfirm = ref(0)
const totalDriverNoConfirm = ref(0)
const totalFinished = ref(0)
const totalGathSubPrice = ref(0)
const totalNoConfirm = ref(0)
const totalOnRoad = ref(0)
const totalOutPrice = ref(0)
const totalPaySubPrice = ref(0)
const totalPrice = ref(0)
const totalSendCar = ref(0)
const totalUnSendCar = ref(0)

const getOrderReadyList_api = () => {
    let data_sun = {
        page: {
            pageNum: 1,
            pageSize: 20,
        },
        cusTypeId: '',
        etime: '',
        id: '',
        serviceMan: '',
        stime: '',
        userId: '',
    }
    let currentDate = new Date();

    // 提取年月日部分
    let year = currentDate.getFullYear();
    let month = String(currentDate.getMonth() + 1).padStart(2, '0');
    let day = String(currentDate.getDate()).padStart(2, '0');

    let todayString = `${year}-${month}-${day}`;
    let data = todayString + ' ' + '00:00:00'

    let nextWeekDate = new Date(currentDate.getTime() + 7 * 24 * 60 * 60 * 1000);
    // 提取年月日部分
    let year2 = nextWeekDate.getFullYear();
    let month2 = String(nextWeekDate.getMonth() + 1).padStart(2, '0');
    let day2 = String(nextWeekDate.getDate()).padStart(2, '0');

    let nextWeekDateString2 = `${year2}-${month2}-${day2}`;
    let data2 = nextWeekDateString2 + ' ' + '23:59:59'
    data_sun.stime = data
    data_sun.etime = data2
    let temer = null
    clearTimeout(temer)
    getOrderReadyList(data_sun).then(res3 => {
        if (res3.data.total != 0) {
            let data_el = '您有' + res3.data.total + '条抢单订单请尽快查看！！！'
            ElNotification({
                type: 'warning',
                message: data_el,
                title: '抢单订单',
                duration: 5000,
                onClick() {
                    let router_list = $mainStore.router_list
                    let list_off = 0
                    for (let i = 0; i < router_list.length; i++) {
                        if (router_list[i].name == 'order_grabbing_hall') {
                            list_off = 1
                        }
                    }
                    if (list_off != 1) {
                        let useRoute_data = {
                            path: '/order_grabbing_hall',
                            name: 'order_grabbing_hall',
                            meta: {
                                title: "抢单大厅",
                                hidden: false, // 路由是否隐藏：true隐藏，false显示
                                icon: "House",
                                keepAlive: true,
                            },
                        }

                        router_list.push(useRoute_data)
                        localStorage.setItem('router_list', CircularJSON.stringify(router_list))
                        $mainStore.router_list = router_list

                    }
                    let useRoute_data2 = {
                        path: '/order_grabbing_hall',
                        name: 'order_grabbing_hall',
                        meta: {
                            title: "抢单大厅",
                            hidden: false, // 路由是否隐藏：true隐藏，false显示
                            icon: "House",
                            keepAlive: true,
                        },
                    }
                    $mainStore.menu = !$mainStore.menu
                    $mainStore.router_name = useRoute_data2
                    $useRouter.push('/order_grabbing_hall')
                }
            })
        }
        temer = setTimeout(() => {
            getOrderReadyList_api()
        }, 18000000);



    })
}
const needSeats_off = ref(true)
const list_api = () => {
    const loading = ElLoading.service({
        lock: true,
        text: '正在加载，中请稍后...',
        background: 'rgba(0, 0, 0, 0.7)',
    })
    let serviceMan_data = find_data.serviceMan
    if (find_data.serviceMan) {
        for (let i = 0; i < getServiceMans_list.value.length; i++) {
            if (find_data.serviceMan == getServiceMans_list.value[i].ftUserId) {
                find_data.serviceMan = getServiceMans_list.value[i].ftUserId + '-' + getServiceMans_list.value[i].realName + '-' + getServiceMans_list.value[i].loginPhone
            }
        }

    }
    let statusList_off = false
    if (!find_data.statusList.length > 0) {

        statusList_off = true
        find_data.statusList = ['NOT_GRAB', 'READY_CAR', 'CAR_READY_CONFIRME', 'DRIVER_READY_RECEIVE', 'DRIVER_CONFIRMED', 'START_TAKE_CUS', 'ON_ROADING', 'FINISHED']
    }
    // let luser = JSON.parse(localStorage.getItem("luser"))
    // let luser_companyNum = luser.companyNum
    // find_data.companyNums = [luser_companyNum]
    // find_data.companyNums = find_data.companyNums.concat(companyNums.value)
    find_data.companyNums = companyNums.value

    getOrderProcessList(find_data).then(res => {
        loading.close()
        if (statusList_off) {
            statusList_off = false
            find_data.statusList = []
        }
        find_data.serviceMan = serviceMan_data
        list_data.value = res.data.list.list
        total.value = res.data.list.total
        totalAlGathPrice.value = res.data.totalAlGathPrice
        totalAlPayPrice.value = res.data.totalAlPayPrice
        totalDriverConfirm.value = res.data.totalDriverConfirm
        totalDriverNoConfirm.value = res.data.totalDriverNoConfirm
        totalFinished.value = res.data.totalFinished
        totalGathSubPrice.value = res.data.totalGathSubPrice
        totalNoConfirm.value = res.data.totalNoConfirm
        totalOnRoad.value = res.data.totalOnRoad
        totalOutPrice.value = res.data.totalOutPrice
        totalPaySubPrice.value = res.data.totalPaySubPrice
        totalPrice.value = res.data.totalPrice
        totalSendCar.value = res.data.totalSendCar
        totalUnSendCar.value = res.data.totalUnSendCar



    })
}
//#endregion

//#region 添加
const add_off = ref(false)
const title = ref('添加账户')
const add_data = reactive({
    bankName: "",
    cardName: "",
    cardNo: "",
    id: "",
})
const add_btn = () => {
    title.value = '添加账户'

    add_data.bankName = ''
    add_data.cardName = ''
    add_data.cardNo = ''
    add_data.id = ''
    add_off.value = true

}


//#endregion
//#region 线下订单确认完团
const circleCheck_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    if (!table_list.value[0].carCompanyId) {
        return ElMessage({
            message: '请选择线下订单！',
            type: 'warning',
        })
    }
    ElMessageBox.confirm(
        '是否确认完团该订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            finishUnderOrder({
                id: table_list.value[0].id
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })
}
//#endregion
//#region 解锁订单
const cancelGathLock_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }

    ElMessageBox.confirm(
        '是否确认解锁该订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            cancelGathLock({
                id: table_list.value[0].id
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })
}
//#endregion

//#region 表格选择
const table_list = ref([])
const headerdragend = (newWidth, oldWidth, column) => {
    console.log(newWidth, oldWidth, column)
    for (let i = 0; i < table_data_list_new.value.length; i++) {
        if (column.property == table_data_list_new.value[i].field) {
            table_data_list_new.value[i].width = newWidth
        }
    }
}

const selection_change_btn = (e) => {
    table_list.value = e
    console.log(e)
}
//#endregion
//#region 修改
const up_off = ref(false)
const up_id = ref('')
const up_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum
    if (table_list.value[0].companyNum != luser_companyNum) {
        if (table_list.value[0].addCompanyNum != luser_companyNum) {
            return ElMessageBox.confirm(
                '该订单是托管单位订单不能修改和删除',
                {
                    confirmButtonText: '确认',
                    // cancelButtonText: '取消',
                    type: 'warning',
                    showCancelButton: false,
                    distinguishCancelAndClose: 'true',
                }
            )
                .then(() => {

                })
                .catch((e) => {


                })
        }

    }

    up_id.value = table_list.value[0].id
    up_off.value = true
}
const upCarMd = (e) => {
    list_api()
    up_off.value = false
}


//#endregion
//#region
const copy_off = ref(false)
const copy_id = ref('')
const copy_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    copy_id.value = table_list.value[0].id
    copy_off.value = true
}
const copyCarMd = (e) => {
    list_api()
    copy_off.value = false
}
//#endregion
const useCarCompanyId_data_api = (e) => {
    let data = ''
    if (e.isCompanyCustomer == 1) {
        if (e.virtuallyUseCarInfo) {
            let data2 = ''
            if (e.useCarCompanyName) {
                data2 = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data2 = e.realName ? e.realName : '匿名'
            }
            data = e.virtuallyUseCarInfo.split('-')[0] + '【' + data2 + '】'
        } else {

            if (e.useCarCompanyName) {
                data = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data = e.realName ? e.realName : '匿名'
            }

        }
    } else if (e.isCompanyCustomer == 0 && e.companyNum == '8112010001') {
        if (e.virtuallyUseCarInfo) {
            let data2 = ''
            if (e.useCarCompanyName) {
                data2 = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data2 = e.realName ? e.realName : '匿名'
            }
            data = e.virtuallyUseCarInfo.split('-')[0] + '【' + data2 + '】'
        } else {

            if (e.useCarCompanyName) {
                data = e.useCarCompanyName ? e.useCarCompanyName : '匿名'
            } else {
                data = e.realName ? e.realName : '匿名'
            }

        }
    } else if (e.isCompanyCustomer == 0 && e.companyNum != '8112010001') {
        if (e.virtuallyUseCarInfo) {
            data = e.virtuallyUseCarInfo.split('-')[0] ? e.virtuallyUseCarInfo : '匿名'
        } else {
            data = ''
        }

    }


    return data
}
const useCarDutyInfo_data_api = (e) => {
    let data = ''
    if (e.isCompanyCustomer == 1) {

        if (e.virtuallyUseCarInfo) {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.virtuallyUseCarInfo.split('-')[0] + '(' + e.useCarDutyInfo + ')'
        } else {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.useCarDutyInfo
        }

    } else if (e.isCompanyCustomer == 0 && e.companyNum == '8112010001') {

        if (e.virtuallyUseCarInfo) {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.virtuallyUseCarInfo.split('-')[0] + '(' + e.useCarDutyInfo + ')'
        } else {
            let realName = e.realName ? e.realName : '匿名'
            let mobile = e.mobile ? e.mobile : ''
            data = e.useCarDutyInfo
        }
    } else if (e.isCompanyCustomer == 0 && e.companyNum != '8112010001') {
        data = e.virtuallyUseCarInfo ? e.virtuallyUseCarInfo.split('-')[0] : '匿名'
    }


    return data


}


// #region 派车
const carNumList = ref([])
const activeName = ref('智能派车')
const handleClick = (e, x) => {
    console.log(e.props.name)
}
const getCarConfigurationType_list = ref([])
const getCarConfigurationType_btn = () => {
    filterCar_data.value.carConfig = ''
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum
    getCarConfigurationType({
        stationListId: '',
        addWay: '',
        seats: filterCar_data.value.seats,
        companyNum: luser_companyNum,
    }).then(res => {

        if (res.code == 1) {
            getCarConfigurationType_list.value = res.data
        } else {

            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const vehicles_off = ref(false)
const vehicles_data = ref({})
const vehicles_btn = (e) => {
    vehicles_data.value = e
    // console.log(e)
    filterCar_data.value.ids = [e.id]
    // filterCar_data.value.seats = e.needSeats <= 5 ? '7' : e.needSeats
    filterCar_data.value.seats = String(e.needSeats)
    filterCar_data.value.startPoint = ''
    filterCar_data.value.endPoint = ''
    filterCar_data.value.best = ''
    filterCar_data.value.companyNums = []
    filterCar_data.value.plateNum = ''
    filterCar_data.value.driverUserIdIsNull = '1'
    filterCar_data.value.fastCondition = '2'


    filterCar_data.value.startTime = e.startTime
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum
    getCarConfigurationType({
        stationListId: '',
        addWay: '',
        seats: filterCar_data.value.seats,
        companyNum: luser_companyNum,
    }).then(res => {

        if (res.code == 1) {
            getCarConfigurationType_list.value = res.data
            filterCar_data.value.carConfig = ''
        } else {

            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
    // dispatchCarPop_api()

    filterOrder_data.value.id = vehicles_data.value.id
    filterOrder_data_radio.value = 2
    filterOrder_data_radio2.value = 5

    filterOrder_data.value.startPoint = false
    filterOrder_data.value.endPoint = true
    filterOrder_data.value.best = false
    filterOrder_data.value.intervalTimeAsc = false
    filterOrder_data.value.routeTimeAsc = true
    filterOrder_data.value.overlapTime = '10'
    filterOrder_data.value.avgSpeed = '40'
    filterOrder_data.value.time = '6'
    filterOrder_data.value.stime = vehicles_data.value.endTime
    filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)

    offlineDispatchCar_data.value.carCompanyId = ''
    offlineDispatchCar_data.value.sendPriceTrust = ''

    offlineDispatchCar_data.value.dispatchMobile = ''
    offlineDispatchCar_data.value.dispatchName = ''
    offlineDispatchCar_data.value.driverName = ''
    offlineDispatchCar_data.value.driverPhone = ''
    offlineDispatchCar_data.value.ids = ''
    offlineDispatchCar_data.value.outPrice = ''
    offlineDispatchCar_data.value.plateNum = ''
    offlineDispatchCar_data.value.carDutyUserId = ''
    set_list.value = []
    // let luser = JSON.parse(localStorage.getItem("luser"))
    // let companyNum_data = luser.companyNum
    if (e.companyNum != luser_companyNum) {
        offlineDispatchCar_data_sendPriceTrust_off.value = true
    } else {
        offlineDispatchCar_data_sendPriceTrust_off.value = false

    }


    if (findTrusteeshipMeComboList.value.length > 0) {
        filterCar_data.value.companyNums.push(e.companyNum)
    } else {
        filterCar_data.value.companyNums = []
    }




    activeName.value = '智能派车'
    companyNums2.value = []
    companyNums2.value.push(e.companyNum)
    filterOrder_api()
    filterCar_api()
    vehicles_off.value = true
}
const offlineDispatchCar_data_sendPriceTrust_off = ref(false)
const vehiclesBtn = () => {
    vehicles_off.value = false
}
const carConfig_list_api = (e) => {
    let data = ''
    for (let i = 0; i < carConfig_list.value.length; i++) {
        if (e.carConfig == carConfig_list.value[i].id) {
            data = '/' + carConfig_list.value[i].name
        }
    }

    return data

}
const carConfig_list = ref([
    {
        id: 'ECONOMICAL',
        name: '经济型',
    }, {
        id: 'COMFORTABLE',
        name: '舒适型',
    }, {
        id: 'LUXURY',
        name: '豪华型',
    }, {
        id: 'BUSINESS_NANNY_CAR',
        name: '商务保姆车',
    }, {
        id: 'ECONOMICAL_MIDDLE_CAR',
        name: '经济中巴',
    }, {
        id: 'COMFORTABLE_MIDDLE_CAR',
        name: '舒适中巴',
    }, {
        id: 'LUXURY_MIDDLE_CAR',
        name: '豪华中巴',
    }, {
        id: 'MIDDLE_NANNY_CAR',
        name: '中巴保姆车',
    },
    {
        id: 'TRAVEL_LARGE_CAR',
        name: '旅游大巴',
    },
    {
        id: 'LARGE_NANNY_CAR',
        name: '大巴保姆车',
    },
])
const filterCar_list = ref([])
const filterCar_data = ref({
    ids: [],
    startPoint: '',
    endPoint: '',
    best: '',
    seats: '7',
    plateNum: '',
    driverUserIdIsNull: '1',
    fastCondition: '2',
    startTime: '',
    carConfig: '',
    companyNums: [],
})
const filterCar_api = () => {
    if (filterCar_data.value.seats == '不限车型') {
        filterCar_data.value.seats = 0
    }
    if (filterOrder_data_radio.value == 1) {
        // 起点
        filterCar_data.value.startPoint = true
        filterCar_data.value.endPoint = false
        filterCar_data.value.best = false
    } else if (filterOrder_data_radio.value == 2) {
        // 终点
        filterCar_data.value.startPoint = false
        filterCar_data.value.endPoint = true
        filterCar_data.value.best = false
    } else if (filterOrder_data_radio.value == 3) {
        // 套接
        filterCar_data.value.startPoint = false
        filterCar_data.value.endPoint = false
        filterCar_data.value.best = true
    }
    // let luser = JSON.parse(localStorage.getItem("luser"))
    // let luser_companyNum = luser.companyNum
    // filterCar_data.value.companyNums = [luser_companyNum]
    // filterCar_data.value.companyNums = filterCar_data.value.companyNums.concat(companyNums2.value)
    filterCar_data.value.companyNums = companyNums2.value
    filterCar2(filterCar_data.value).then(res => {
        if (filterCar_data.value.seats == 0) {
            filterCar_data.value.seats = '不限车型'
        }
        if (res.code == 1) {
            filterCar_list.value = res.data
        }
    })
}
const dispatchCarPop_api = () => {
    dispatchCarPop({
        id: vehicles_data.value.id
    }).then(res => {
        if (res.code == 1) {
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const filterCar_data_find = () => {

    filterCar_api()
}
// 智能派车
const set_list = ref([])
const set_over_btn = (e) => {
    console.log(e)
    for (let i = 0; i < set_list.value.length; i++) {
        if (e.id == set_list.value[i].id) {
            set_list.value.splice(i, 1); // 删除一个元素
        }
    }
    if (set_list.value.length > 0) {
        if (filterOrder_data.value.time == '12') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover12(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = set_list.value[set_list.value.length - 1].startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = set_list.value[set_list.value.length - 1].endTime
                filterOrder_data.value.etime = hover12(set_list.value[set_list.value.length - 1].endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover12(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = hover12(set_list.value[set_list.value.length - 1].endTime, 1)
            }
        } else if (filterOrder_data.value.time == '24') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover24(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = set_list.value[set_list.value.length - 1].startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = set_list.value[set_list.value.length - 1].endTime
                filterOrder_data.value.etime = hover24(set_list.value[set_list.value.length - 1].endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover24(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = hover24(set_list.value[set_list.value.length - 1].endTime, 1)
            }
        } else if (filterOrder_data.value.time == '48') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover48(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = set_list.value[set_list.value.length - 1].startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = set_list.value[set_list.value.length - 1].endTime
                filterOrder_data.value.etime = hover48(set_list.value[set_list.value.length - 1].endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover48(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = hover48(set_list.value[set_list.value.length - 1].endTime, 1)
            }
        } else if (filterOrder_data.value.time == '6') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover6(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = set_list.value[set_list.value.length - 1].startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = set_list.value[set_list.value.length - 1].endTime
                filterOrder_data.value.etime = hover6(set_list.value[set_list.value.length - 1].endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover6(set_list.value[set_list.value.length - 1].startTime, 0)
                filterOrder_data.value.etime = hover6(set_list.value[set_list.value.length - 1].endTime, 1)
            }
        }
        filterOrder_api()
    } else {
        if (filterOrder_data.value.time == '12') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = vehicles_data.value.startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = vehicles_data.value.endTime
                filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
            }
        } else if (filterOrder_data.value.time == '24') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = vehicles_data.value.startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = vehicles_data.value.endTime
                filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
            }
        } else if (filterOrder_data.value.time == '48') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = vehicles_data.value.startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = vehicles_data.value.endTime
                filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
            }
        } else if (filterOrder_data.value.time == '6') {
            if (filterOrder_data_radio.value == 1) {
                // 起点
                filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = vehicles_data.value.startTime
            } else if (filterOrder_data_radio.value == 2) {
                // 终点
                filterOrder_data.value.stime = vehicles_data.value.endTime
                filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
            } else if (filterOrder_data_radio.value == 3) {
                // 套接
                filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
                filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
            }
        }
        filterOrder_api()
    }

}
const set_btn = (e) => {
    set_list.value.push(e)
    if (filterOrder_data.value.time == '12') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover12(e.startTime, 0)
            filterOrder_data.value.etime = e.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = e.endTime
            filterOrder_data.value.etime = hover12(e.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover12(e.startTime, 0)
            filterOrder_data.value.etime = hover12(e.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '24') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover24(e.startTime, 0)
            filterOrder_data.value.etime = e.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = e.endTime
            filterOrder_data.value.etime = hover24(e.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover24(e.startTime, 0)
            filterOrder_data.value.etime = hover24(e.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '48') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover48(e.startTime, 0)
            filterOrder_data.value.etime = e.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = e.endTime
            filterOrder_data.value.etime = hover48(e.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover48(e.startTime, 0)
            filterOrder_data.value.etime = hover48(e.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '6') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover6(e.startTime, 0)
            filterOrder_data.value.etime = e.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = e.endTime
            filterOrder_data.value.etime = hover6(e.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover6(e.startTime, 0)
            filterOrder_data.value.etime = hover6(e.endTime, 1)
        }
    }
    filterOrder_api()
    console.log(set_list.value)
}
const sendPriceTrust_off = ref(false)
const sendPriceTrust_num = ref(0)
const sendPriceTrust_off_data = ref({})
const sendPriceTrust_data = ref({
    sendPriceTrust: '',
    sendPriceOther: '',
})
const sendPriceTrust_ok_btn = () => {
    sendPriceTrust_off_data.value.sendPriceTrust = sendPriceTrust_data.value.sendPriceTrust
    sendPriceTrust_off_data.value.sendPriceOther = sendPriceTrust_data.value.sendPriceOther

    return ElMessageBox.confirm(
        '确定提交',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            confirmSendOrder({
                sendInfo: [sendPriceTrust_off_data.value],
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    sendPriceTrust_off.value = false
                    vehicles_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })


        })
        .catch((e) => {


        })

}
const filterCar_data_ok_btn = (e) => {


    let datanum = 0
    let luser = JSON.parse(localStorage.getItem("luser"))
    let companyNum_data = luser.companyNum


    // if (e.companyNum != vehicles_data.value.companyNum && e.companyNum != companyNum_data) {
    //     datanum = 2
    //     sendPriceTrust_num.value = 2
    // } else if (e.companyNum == vehicles_data.value.companyNum && e.companyNum != companyNum_data) {
    //     datanum = 1
    //     sendPriceTrust_num.value = 1
    // } else {
    //     datanum = 0
    //     sendPriceTrust_num.value = 0
    // }

    if (e.companyNum == vehicles_data.value.companyNum) {
        datanum = 0
        sendPriceTrust_num.value = 0
    } else {
        if (e.companyNum == companyNum_data) {
            datanum = 1
            sendPriceTrust_num.value = 1
        } else {
            datanum = 2
            sendPriceTrust_num.value = 2
        }
    }






    if (datanum == 0) {
        let datamsg = '是否确认派车?'
        if (e.lastOrderId || e.orderId) {
            datamsg = '当前行程与此车辆已派行程有冲突，是否继续强制派单?'
        } else {
            datamsg = '是否确认派车?'
        }

        return ElMessageBox.confirm(
            datamsg,
            {
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning',
                distinguishCancelAndClose: 'true',
            }
        )
            .then(() => {
                let ids = [vehicles_data.value.id]
                let cancelorderId = []
                if (e.orderId) {
                    cancelorderId.push(e.orderId)
                }
                if (e.lastOrderId) {
                    cancelorderId.push(e.lastOrderId)
                }
                for (let i = 0; i < set_list.value.length; i++) {
                    ids.push(set_list.value[i].id)
                }
                let ps = {
                    orderId: ids.join(','),
                    plateNum: e.plateNum,
                    driverUserId: e.driverUserId,
                    cancelNum: '',
                    sendPrice: '',
                    cancelorderId: cancelorderId.join(','),
                    sendPriceTrust: '',
                    sendPriceOther: '',
                }

                confirmSendOrder({
                    sendInfo: [ps],
                }).then(res => {
                    if (res.code == 1) {
                        list_api()
                        vehicles_off.value = false
                        return ElMessage({
                            message: res.msg,
                            type: 'success',
                        })
                    } else {
                        return ElMessage({
                            message: res.msg,
                            type: 'warning',
                        })
                    }
                })


            })
            .catch((e) => {


            })
    } else if (datanum == 1) {
        sendPriceTrust_data.value.sendPriceTrust = vehicles_data.value.price
        sendPriceTrust_data.value.sendPriceOther = ''

        let ids = [vehicles_data.value.id]
        let cancelorderId = []
        if (e.orderId) {
            cancelorderId.push(e.orderId)
        }
        if (e.lastOrderId) {
            cancelorderId.push(e.lastOrderId)
        }
        for (let i = 0; i < set_list.value.length; i++) {
            ids.push(set_list.value[i].id)
        }
        let ps = {
            orderId: ids.join(','),
            plateNum: e.plateNum,
            driverUserId: e.driverUserId,
            cancelNum: '',
            sendPrice: '',
            cancelorderId: cancelorderId.join(','),
            sendPriceTrust: sendPriceTrust_data.value.sendPriceTrust,
            sendPriceOther: '',
        }
        sendPriceTrust_off_data.value = ps

        sendPriceTrust_off.value = true
    } else if (datanum == 2) {
        sendPriceTrust_data.value.sendPriceTrust = vehicles_data.value.price
        sendPriceTrust_data.value.sendPriceOther = vehicles_data.value.price
        let ids = [vehicles_data.value.id]
        let cancelorderId = []
        if (e.orderId) {
            cancelorderId.push(e.orderId)
        }
        if (e.lastOrderId) {
            cancelorderId.push(e.lastOrderId)
        }
        for (let i = 0; i < set_list.value.length; i++) {
            ids.push(set_list.value[i].id)
        }
        let ps = {
            orderId: ids.join(','),
            plateNum: e.plateNum,
            driverUserId: e.driverUserId,
            cancelNum: '',
            sendPrice: '',
            cancelorderId: cancelorderId.join(','),
            sendPriceTrust: sendPriceTrust_data.value.sendPriceTrust,
            sendPriceOther: sendPriceTrust_data.value.sendPriceOther,
        }
        sendPriceTrust_off_data.value = ps

        sendPriceTrust_off.value = true
    } else {
        return ElMessage({
            message: '派车错误，请联系管理',
            type: 'success',
        })
    }



}
const filterOrder_table_list = ref([])
const filterOrder_selection_change_btn = (e) => {
    filterOrder_table_list.value = e
    console.log(filterOrder_table_list.value)
    let ids = [vehicles_data.value.id]

    for (let i = 0; i < e.length; i++) {
        ids.push(e[i].id)
    }
    filterCar_data.value.ids = ids
}
const filterOrder_data_change = () => {
    if (filterOrder_data.value.time == '12') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '24') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '48') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '6') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        }
    }
}
const filterOrder_data_find = () => {
    filterOrder_api()
}
const filterOrder_data_radio = ref(2)
const filterOrder_data_radio_change = () => {
    if (filterOrder_data.value.time == '12') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover12(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover12(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '24') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover24(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover24(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '48') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover48(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover48(vehicles_data.value.endTime, 1)
        }
    } else if (filterOrder_data.value.time == '6') {
        if (filterOrder_data_radio.value == 1) {
            // 起点
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = vehicles_data.value.startTime
        } else if (filterOrder_data_radio.value == 2) {
            // 终点
            filterOrder_data.value.stime = vehicles_data.value.endTime
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        } else if (filterOrder_data_radio.value == 3) {
            // 套接
            filterOrder_data.value.stime = hover6(vehicles_data.value.startTime, 0)
            filterOrder_data.value.etime = hover6(vehicles_data.value.endTime, 1)
        }
    }
}
const filterOrder_data_radio2 = ref(5)
const filterOrder_data = ref({
    id: '',
    startPoint: true,
    endPoint: false,
    stime: '',
    etime: '',
    best: false,
    avgSpeed: '40',
    overlapTime: '10',
    intervalTimeAsc: false,
    routeTimeAsc: true,
    notContainOrderId: [],
    time: '6',
})
const filterOrder_list = ref([])
const filterOrder_api = () => {


    if (filterOrder_data_radio.value == 1) {
        // 起点
        filterOrder_data.value.startPoint = true
        filterOrder_data.value.endPoint = false
        filterOrder_data.value.best = false
    } else if (filterOrder_data_radio.value == 2) {
        // 终点
        filterOrder_data.value.startPoint = false
        filterOrder_data.value.endPoint = true
        filterOrder_data.value.best = false
    } else if (filterOrder_data_radio.value == 3) {
        // 套接
        filterOrder_data.value.startPoint = false
        filterOrder_data.value.endPoint = false
        filterOrder_data.value.best = true
    }
    if (filterOrder_data_radio2.value == 4) {
        filterOrder_data.value.intervalTimeAsc = true
        filterOrder_data.value.routeTimeAsc = false
    } else if (filterOrder_data_radio2.value == 5) {
        filterOrder_data.value.intervalTimeAsc = false
        filterOrder_data.value.routeTimeAsc = true
    }
    if (set_list.value.length > 0) {
        filterOrder_data.value.notContainOrderId = [vehicles_data.value.id]
        for (let i = 0; i < set_list.value.length; i++) {

            filterOrder_data.value.notContainOrderId.push(set_list.value[i].id)
        }
    } else {
        filterOrder_data.value.notContainOrderId = [vehicles_data.value.id]
    }
    if (set_list.value.length > 0) {
        filterOrder_data.value.id = set_list.value[set_list.value.length - 1].id

    } else {
        filterOrder_data.value.id = vehicles_data.value.id

    }
    filterOrder(filterOrder_data.value).then(res => {
        if (res.code == 1) {
            filterOrder_list.value = res.data
        } else {
            filterOrder_list.value = res.data
        }
    })
}
const hover6 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 6 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 6 * 60 * 60 * 1000); // 24小时前的时间
    }

    console.log(x)
    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
const hover12 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 12 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 12 * 60 * 60 * 1000); // 24小时前的时间
    }

    console.log(x)
    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
const hover24 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 24 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000); // 24小时前的时间
    }


    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
const hover48 = (e, x) => {
    let currentDate = new Date(e);
    let pastDate = ''
    if (x == 0) {
        pastDate = new Date(currentDate.getTime() - 48 * 60 * 60 * 1000); // 24小时前的时间
    } else {
        pastDate = new Date(currentDate.getTime() + 48 * 60 * 60 * 1000); // 24小时前的时间
    }


    let year = pastDate.getFullYear();
    let month = String(pastDate.getMonth() + 1).padStart(2, '0');
    let day = String(pastDate.getDate()).padStart(2, '0');
    let hours = String(pastDate.getHours()).padStart(2, '0');
    let minutes = String(pastDate.getMinutes()).padStart(2, '0');
    let seconds = String(pastDate.getSeconds()).padStart(2, '0');
    let formattedDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    return formattedDateTime
}
// 线下派车
// CARTEAM
const offlineDispatchCar_data = ref({
    carCompanyId: '',
    dispatchMobile: '',
    dispatchName: '',
    driverName: '',
    driverPhone: "",
    ids: '',
    outPrice: '',
    plateNum: '',
    carDutyUserId: '',
    sendPriceTrust: '',
})
const carCompanyId_change = () => {
    for (let i = 0; i < findComboCusList_list.value.length; i++) {

        if (offlineDispatchCar_data.value.carCompanyId == findComboCusList_list.value[i].id) {
            offlineDispatchCar_data.value.carDutyUserId = findComboCusList_list.value[i].userId
            offlineDispatchCar_data.value.dispatchMobile = findComboCusList_list.value[i].cusPhone
            offlineDispatchCar_data.value.dispatchName = findComboCusList_list.value[i].cusRealName
        }
    }
}


const offlineDispatchCar_ref = ref('')
const filterCar_data_btn = () => {
    offlineDispatchCar_data.value.ids = [vehicles_data.value.id]
    offlineDispatchCar_ref.value.validate((valid) => {
        if (!valid) {
            return false;
        } else {
            offlineDispatchCar(offlineDispatchCar_data.value).then(res => {
                if (res.code == 1) {
                    list_api()
                    vehicles_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        }
    })

}
// #endregion

// #region 通知
const noticeDriver = (e) => {
    ElMessageBox.confirm(
        '确定通知所选定的订单驾驶员?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = []
            if (table_list.value.length < 1) {
                ps = [e.id]
            } else {
                for (let i = 0; i < table_list.value.length; i++) {
                    ps.push(table_list.value[i].id)
                }
            }


            JLConfirmSend({
                ids: ps
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })
}

// #endregion

// #region 非包车订单确认/拒绝接单
const receiveOrRefuse_btn = (e) => {
    ElMessageBox.confirm(
        '非包车订单确认/拒绝接单',
        {
            confirmButtonText: '确认接单',
            cancelButtonText: '拒绝接单',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = {
                id: e.id,
                isReceiveByTeam: 1,
            }
            receiveOrRefuse(ps).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {
            let ps = {
                id: e.id,
                isReceiveByTeam: 0,
            }
            receiveOrRefuse(ps).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })

        })
}

// #endregion

// #region 奖励或者惩罚
const adupRewardPunish_data = ref({
    id: '',
    orderId: '',
    rewardPunishType: '0',
    content: '',
    flowPath: '',
    driverIndemnityPrice: '0',
    driverPunishPrice: '0',
    indemnityPrice: '0',
    payWay: '0',
    proveUrl: '',
    driverUserId: '',
})
const adupRewardPunish_off = ref(false)
const adupRewardPunish_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    adupRewardPunish_data.value.rewardPunishType = '0'
    adupRewardPunish_data.value.content = ''
    adupRewardPunish_data.value.flowPath = ''
    adupRewardPunish_data.value.driverIndemnityPrice = '0'
    adupRewardPunish_data.value.driverPunishPrice = '0'
    adupRewardPunish_data.value.indemnityPrice = '0'
    adupRewardPunish_data.value.payWay = '0'
    adupRewardPunish_data.value.id = ''
    adupRewardPunish_data.value.orderId = table_list.value[0].id
    adupRewardPunish_data.value.driverUserId = table_list.value[0].driverUserId


    rawFile_list.value = []
    rawFile_list2.value = []
    adupRewardPunish_rawFile_list.value = []
    adupRewardPunish_off.value = true
}
const adupRewardPunishBtn = () => {
    ElMessageBox.confirm(
        '确认处理?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {

            adupRewardPunish_data.value.proveUrl = adupRewardPunish_rawFile_list.value.join(',')
            adupRewardPunish(adupRewardPunish_data.value).then(res => {
                if (res.code == 1) {
                    list_api()
                    adupRewardPunish_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    adupRewardPunish_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
const dialogImageUrl = ref('')
const dialogVisible = ref(false)
const handlePictureCardPreview = (uploadFile) => {
    dialogImageUrl.value = uploadFile.response.data.file.url
    dialogVisible.value = true
}
const handleRemove = (uploadFile, uploadFiles) => {
    let url_data = uploadFile.response.data.file.url

    for (let i = 0; i < adupRewardPunish_rawFile_list.value.length; i++) {
        if (adupRewardPunish_rawFile_list.value[i] == url_data) {
            adupRewardPunish_rawFile_list.value.splice(i, 1);
        }
    }
}


const getRewardPunishById_btn = (e) => {
    adupRewardPunish_data.value.orderId = e.id
    adupRewardPunish_data.value.id = e.rewardPunishId
    getRewardPunishById({ id: adupRewardPunish_data.value.id }).then(res => {
        if (res.code == 1) {
            rawFile_list.value = []
            rawFile_list2.value = []
            adupRewardPunish_rawFile_list.value = []
            adupRewardPunish_data.value.rewardPunishType = String(res.data.rewardPunishType)
            adupRewardPunish_data.value.content = res.data.content
            adupRewardPunish_data.value.flowPath = res.data.flowPath
            adupRewardPunish_data.value.driverIndemnityPrice = res.data.driverIndemnityPrice
            adupRewardPunish_data.value.driverPunishPrice = res.data.driverPunishPrice
            adupRewardPunish_data.value.indemnityPrice = res.data.indemnityPrice
            adupRewardPunish_data.value.payWay = String(res.data.payWay)
            adupRewardPunish_data.value.proveUrl = res.data.proveUrl
            adupRewardPunish_data.value.driverUserId = res.data.driverUserId
            adupRewardPunish_rawFile_list.value = res.data.proveUrl ? res.data.proveUrl.split(',') : ''
            adupRewardPunish_off.value = true
        } else {

            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })

}

const delRewardPunish_btn = () => {
    ElMessageBox.confirm(
        '确认删除?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            delRewardPunish({ id: adupRewardPunish_data.value.id }).then(res => {
                if (res.code == 1) {
                    list_api()
                    adupRewardPunish_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    adupRewardPunish_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })
}
// #endregion



// #region 滴滴打车设置
const isUseDidi_data = ref({
    off: false,
    isUseDidi: false,
})
const isUseDidi_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    isUseDidi_data.value.isUseDidi = table_list.value[0].isUseDidi == 0 ? false : true
    isUseDidi_data.value.off = true
}
const isUseDidiBtn = () => {
    let ps = {
        ids: [table_list.value[0].id],
        isUseDidi: isUseDidi_data.value.isUseDidi ? 1 : 0
    }
    isUseDidi(ps).then(res => {
        if (res.code == 1) {
            list_api()
            isUseDidi_data.value.off = false
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            isUseDidi_data.value.off = false
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
// #endregion

//#region 代收二维码
const QRcode = ref({
    off: false,
    helpGathUrl: '',
    helpGathPrice: '',
})
const setHelpGathUrl_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    QRcode.value.helpGathUrl = table_list.value[0].helpGathUrl
    QRcode.value.helpGathPrice = table_list.value[0].helpGathPrice
    QRcode.value.off = true
}
const setHelpGathUrl_btn2 = (e) => {

    QRcode.value.helpGathUrl = e.helpGathUrl
    QRcode.value.helpGathPrice = e.helpGathPrice
    QRcode.value.off = true
}

const addQRcodeBtn = () => {
    let ps = {
        ids: [table_list.value[0].id],
        helpGathUrl: QRcode.value.helpGathUrl,
        helpGathPrice: QRcode.value.helpGathPrice,
    }

    setHelpGathUrl(ps).then(res => {
        if (res.code == 1) {
            list_api()
            QRcode.value.off = false
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            QRcode.value.off = false
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}

const rawFile_list = ref([])
const rawFile_list2 = ref([])
const adupRewardPunish_rawFile_list = ref([])
const handleAvatarSuccess = (response, uploadFile) => {

    QRcode.value.helpGathUrl = response.data.file.url

}
const handleAvatarSuccess2 = (response, uploadFile) => {

    adupRewardPunish_rawFile_list.value.push(response.data.file.url)

}
const beforeAvatarUpload = (rawFile) => {
    rawFile_list.value = []
    if (rawFile.type == 'image/jpeg' || rawFile.type == 'image/png' || rawFile.type == 'image/gif') {
        if (rawFile.size / 1024 / 1024 > 5) {
            ElMessage.error('图片大小不能大于5M!')
            return false
        }
    } else {
        ElMessage.error('请上传图片!')
        return false
    }

    rawFile_list.value.push(rawFile)
    return true

}
const beforeAvatarUpload2 = (rawFile) => {
    rawFile_list2.value = []
    if (rawFile.type == 'image/jpeg' || rawFile.type == 'image/png' || rawFile.type == 'image/gif') {
        if (rawFile.size / 1024 / 1024 > 5) {
            ElMessage.error('图片大小不能大于5M!')
            return false
        }
    } else {
        ElMessage.error('请上传图片!')
        return false
    }

    rawFile_list2.value.push(rawFile)
    return true

}
const remove_btn = () => {
    QRcode.value.helpGathUrl = ''
}
//#endregion

//#region 修改车辆  
const up_car_off = ref(false)
const up_car_e = ref({})
const up_car_list = ref([])
const up_car_data = reactive({
    stime: '',
    etime: '',
    force: "0",
    geSeats: '',
    orderNum: '',
    plateNum: '',
})
const findCanUseCar_api = () => {
    findCanUseCar(up_car_data).then(res => {
        if (res.code == 1) {
            up_car_list.value = res.data.cars
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const up_car = (e) => {
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum
    if (e.companyNum == luser_companyNum) {
        if (e.carCompanyId) {
            xianxiaup_car_data.carCompanyId = e.carCompanyId
            xianxiaup_car_data.carDutyUserId = e.carDutyUserId
            xianxiaup_car_data.id = e.id
            xianxiaup_car_data.driverPhone = e.driverPhone
            xianxiaup_car_data.outPrice = e.outPrice
            xianxiaup_car_data.sendPriceTrust = e.sendPriceTrust
            xianxiaup_car_data.driverName = e.driverName
            xianxiaup_car_data.dispatchName = e.dispatchName
            xianxiaup_car_data.dispatchMobile = e.dispatchMobile
            xianxiaup_car_data.plateNum = e.plateNum
            for (let i = 0; i < findComboCusList_list.value.length; i++) {

                if (xianxiaup_car_data.carCompanyId == findComboCusList_list.value[i].id) {
                    xianxiaup_car_data.carDutyUserId = findComboCusList_list.value[i].userId
                    xianxiaup_car_data.dispatchMobile = findComboCusList_list.value[i].cusPhone
                    xianxiaup_car_data.dispatchName = findComboCusList_list.value[i].cusRealName
                }
            }
            xianxiaup_car_off.value = true
        } else {
            up_car_data.stime = e.startTime
            up_car_data.etime = e.endTime
            up_car_data.force = '0'
            up_car_data.geSeats = e.needSeats ? e.needSeats : e.personNum + 1
            up_car_data.orderNum = e.orderNum
            up_car_data.plateNum = ''
            up_car_e.value = e

            findCanUseCar_api()
            up_car_off.value = true
        }
    } else {
        up_car_data.stime = e.startTime
        up_car_data.etime = e.endTime
        up_car_data.force = '0'
        up_car_data.geSeats = e.needSeats ? e.needSeats : e.personNum + 1
        up_car_data.orderNum = e.orderNum
        up_car_data.plateNum = ''
        up_car_e.value = e

        findCanUseCar_api()
        up_car_off.value = true
    }

}
const up_car_find = () => {
    findCanUseCar_api()
}
const up_car_selection_change_list = ref([])

const up_car_selection_change_btn = (e) => {
    console.log(e)
    up_car_selection_change_list.value = e
}
const up_car_ok_btn = () => {
    if (up_car_selection_change_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }

    ElMessageBox.confirm(
        '确认修改车辆?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            changeCar({
                id: up_car_e.value.id,
                plateNum: up_car_selection_change_list.value[0].plateNum,
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    up_car_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })




}
//#endregion

//#region 修改车驾驶员
const up_driver_off = ref(false)
const up_driver_e = ref({})
const up_driver_list = ref([])
const up_driver_data = reactive({
    stime: '',
    etime: '',
    driverInfo: "",
    force: '0',
    orderNum: '',
})
const up_driver_api = () => {
    findCanUseDriver(up_driver_data).then(res => {
        up_driver_list.value = res.data.drivers
    })
}
const xianxiaup_car_off = ref(false)
const xianxiaup_car_data = reactive({
    carCompanyId: '',
    carDutyUserId: '',
    id: '',
    driverPhone: '',
    driverName: '',
    dispatchName: '',
    dispatchMobile: '',
    plateNum: '',
    outPrice: '',
    sendPriceTrust: '',
})
const xianxiacarCompanyId_change = () => {
    for (let i = 0; i < findComboCusList_list.value.length; i++) {

        if (xianxiaup_car_data.carCompanyId == findComboCusList_list.value[i].id) {
            xianxiaup_car_data.carDutyUserId = findComboCusList_list.value[i].userId
            xianxiaup_car_data.dispatchMobile = findComboCusList_list.value[i].cusPhone
            xianxiaup_car_data.dispatchName = findComboCusList_list.value[i].cusRealName
        }
    }
}
const xianxiafilterCar_data_btn = () => {
    changeUnder(xianxiaup_car_data).then(res => {
        if (res.code == 1) {
            list_api()
            xianxiaup_car_off.value = false
            return ElMessage({
                message: res.msg,
                type: 'success',
            })
        } else {
            return ElMessage({
                message: res.msg,
                type: 'warning',
            })
        }
    })
}
const up_driverName = (e) => {
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum
    if (e.companyNum == luser_companyNum) {
        if (e.carCompanyId) {
            xianxiaup_car_data.carCompanyId = e.carCompanyId
            xianxiaup_car_data.carDutyUserId = e.carDutyUserId
            xianxiaup_car_data.id = e.id
            xianxiaup_car_data.driverPhone = e.driverPhone
            xianxiaup_car_data.driverName = e.driverName
            xianxiaup_car_data.outPrice = e.outPrice
            xianxiaup_car_data.sendPriceTrust = e.sendPriceTrust
            xianxiaup_car_data.dispatchName = e.dispatchName
            xianxiaup_car_data.dispatchMobile = e.dispatchMobile
            xianxiaup_car_data.plateNum = e.plateNum
            for (let i = 0; i < findComboCusList_list.value.length; i++) {

                if (xianxiaup_car_data.carCompanyId == findComboCusList_list.value[i].id) {
                    xianxiaup_car_data.carDutyUserId = findComboCusList_list.value[i].userId
                    xianxiaup_car_data.dispatchMobile = findComboCusList_list.value[i].cusPhone
                    xianxiaup_car_data.dispatchName = findComboCusList_list.value[i].cusRealName
                }
            }
            xianxiaup_car_off.value = true
        } else {
       
            up_driver_data.stime = e.startTime
            up_driver_data.etime = e.endTime
            up_driver_data.force = '0'
            up_driver_data.orderNum = ''
            up_driver_data.driverInfo = ''
            up_driver_e.value = e
            console.log(up_driver_e.value)
            up_driver_api()
            up_driver_off.value = true
        }
    } else {
        up_driver_data.stime = e.startTime
        up_driver_data.etime = e.endTime
        up_driver_data.force = '0'
        up_driver_data.orderNum = ''
        up_driver_data.driverInfo = ''
        up_driver_e.value = e
        console.log(up_driver_e.value)
        up_driver_api()
        up_driver_off.value = true
    }




}
const up_driver_find = () => {
    up_driver_api()
}
const up_driver_change_list = ref([])
const up_driver_change_btn = (e) => {
    up_driver_change_list.value = e
}
const up_driver_ok_btn = () => {
    if (up_driver_change_list.value.length != 1) {
        return ElMessage({
            message: '请选择一条数据！',
            type: 'warning',
        })
    }
    let ps = {
        driverName: up_driver_change_list.value[0].driverName,
        driverPhone: up_driver_change_list.value[0].driverPhone,
        driverUserId: up_driver_change_list.value[0].userId,
        id: up_driver_e.value.id,
    }


    ElMessageBox.confirm(
        '确认修改车辆?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            changeDriver(ps).then(res => {
                if (res.code == 1) {
                    list_api()
                    up_driver_off.value = false
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })





}

//#endregion

//#region 取消派车
const cancelDispatchCar_btn = () => {

    if (table_list.value.length < 1) {
        return ElMessage({
            message: '请选择数据！',
            type: 'warning',
        })
    }

    ElMessageBox.confirm(
        '是否取消派车?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = []
            for (let i = 0; i < table_list.value.length; i++) {
                ps.push(table_list.value[0].id)
            }

            cancelDispatchCar({
                ids: ps
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
//#endregion

//#region 合并订单
const mergeProcess_btn = () => {

    if (table_list.value.length < 2) {
        return ElMessage({
            message: '请选择至少两条数据！',
            type: 'warning',
        })
    }

    ElMessageBox.confirm(
        '是否合并订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = []
            for (let i = 0; i < table_list.value.length; i++) {
                ps.push(table_list.value[i].id)
            }

            mergeProcess({
                ids: ps
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
//#endregion



//#region 取消合并
const cancelMergeProcess_btn = () => {
    if (table_list.value.length != 1) {
        return ElMessage({
            message: '只能选择一条数据取消合并',
            type: 'warning',
        })
    }

    ElMessageBox.confirm(
        '是否取消合并订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {


            cancelMergeProcess({
                id: table_list.value[0].id
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
//#endregion


//#region 删除
const del_btn = () => {
    if (table_list.value.length < 1) {
        return ElMessage({
            message: '请选择数据！',
            type: 'warning',
        })
    }
    let luser = JSON.parse(localStorage.getItem("luser"))
    let luser_companyNum = luser.companyNum
    if (table_list.value[0].companyNum != luser_companyNum) {
        if (table_list.value[0].addCompanyNum != luser_companyNum) {
            console.log(table_list.value[0].companyNum, table_list.value[0].addCompanyNum, luser_companyNum)
            return ElMessageBox.confirm(
                '该订单是托管单位订单不能修改和删除',
                {
                    confirmButtonText: '确认',
                    // cancelButtonText: '取消',
                    type: 'warning',
                    showCancelButton: false,
                    distinguishCancelAndClose: 'true',
                }
            )
                .then(() => {

                })
                .catch((e) => {


                })
        }

    }

    ElMessageBox.confirm(
        '是否确认删除订单?',
        {
            confirmButtonText: '确认',
            cancelButtonText: '取消',
            type: 'warning',
            distinguishCancelAndClose: 'true',
        }
    )
        .then(() => {
            let ps = []
            for (let i = 0; i < table_list.value.length; i++) {
                ps.push(table_list.value[i].id)
            }

            omsorderdelete({
                ids: ps
            }).then(res => {
                if (res.code == 1) {
                    list_api()
                    return ElMessage({
                        message: res.msg,
                        type: 'success',
                    })
                } else {
                    return ElMessage({
                        message: res.msg,
                        type: 'warning',
                    })
                }
            })
        })
        .catch((e) => {


        })

}
//#endregion


//#region 搜索
const search_btn = () => {
    localStorage.setItem('order_follow_up', CircularJSON.stringify(find_data))
    list_api()
}
//#endregion


</script>

<style scoped lang='scss'>
.route-tips {
    max-width: 500px !important;
}

.route-tips2 {
    max-width: 200px !important;
}

.form_Css>.el-form-item {
    margin-right: 10px !important;
}

::v-deep(.el-table__row:hover) {
    color: #666 !important;
}
</style>

<style>
.avatar-uploader .avatar {
    width: 200px;
    height: 200px;
    display: block;
}


.avatar-uploader .el-upload {
    border: 1px dashed var(--el-border-color);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--el-transition-duration-fast);
}

.avatar-uploader .el-upload:hover {
    border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 200px;
    height: 200px;
    text-align: center;
}

.col-items::-webkit-scrollbar {
    width: 5px !important;
}

.col-items>label {
    margin-left: 0px !important;
    margin-top: 5px;
    width: 100%;
}


.el-table .el-table__cell {
    padding: 0px !important;
}
</style>
